Date: Mon, 28 Oct 2019 11:56:17 -0400 Johannes Weiner wrote: > > On Sat, Oct 26, 2019 at 07:28:08PM +0800, Hillf Danton wrote: > > > > The cpu preemption feature makes a task able to preempt other tasks > > of lower priorities for cpu. It has been around for a while. > > > > This work introduces task prio into page reclaiming in order to add > > the page preemption feature that makes a task able to preempt other > > tasks of lower priorities for page. > > > > No page will be reclaimed on behalf of tasks of lower priorities > > ... at which point they'll declare OOM and kill the high-pri task? Fixed. Thanks. --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -164,6 +164,11 @@ static bool oom_unkillable_task(struct t return true; if (p->flags & PF_KTHREAD) return true; + +#ifdef CONFIG_PAGE_PREEMPTION + if (p->prio < current->prio) + return true; +#endif return false; } -- > Please have a look at the cgroup2 memory.low control. This memory > prioritization problem has already been solved. Scooter never runs in subway. Fixed. --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -197,8 +198,18 @@ struct page { /* Usage count. *DO NOT USE DIRECTLY*. See page_ref.h */ atomic_t _refcount; + /* 32/56 bytes above */ + #ifdef CONFIG_MEMCG struct mem_cgroup *mem_cgroup; +#else +#ifdef CONFIG_64BIT + union { + int prio; + void *__pad; + }; +#define CONFIG_PAGE_PREEMPTION PP +#endif #endif /* --