[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c745df86-b95c-e82b-42ba-519da4f448ab@i-love.sakura.ne.jp>
Date: Fri, 26 Apr 2019 06:12:27 +0900
From: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: akpm@...ux-foundation.org, mhocko@...e.com, rientjes@...gle.com,
willy@...radead.org, yuzhoujian@...ichuxing.com,
jrdr.linux@...il.com, guro@...com, hannes@...xchg.org,
ebiederm@...ssion.com, shakeelb@...gle.com, christian@...uner.io,
minchan@...nel.org, timmurray@...gle.com, dancol@...gle.com,
joel@...lfernandes.org, jannh@...gle.com, linux-mm@...ck.org,
lsf-pc@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
kernel-team@...roid.com
Subject: Re: [RFC 1/2] mm: oom: expose expedite_reclaim to use oom_reaper
outside of oom_kill.c
On 2019/04/11 10:43, Suren Baghdasaryan wrote:
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 3a2484884cfd..6449710c8a06 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -1102,6 +1102,21 @@ bool out_of_memory(struct oom_control *oc)
> return !!oc->chosen;
> }
>
> +bool expedite_reclaim(struct task_struct *task)
> +{
> + bool res = false;
> +
> + task_lock(task);
> + if (task_will_free_mem(task)) {
mark_oom_victim() needs to be called under oom_lock mutex after
checking that oom_killer_disabled == false. Since you are trying
to trigger this function from signal handler, you might want to
defer until e.g. WQ context.
> + mark_oom_victim(task);
> + wake_oom_reaper(task);
> + res = true;
> + }
> + task_unlock(task);
> +
> + return res;
> +}
> +
> /*
> * The pagefault handler calls here because it is out of memory, so kill a
> * memory-hogging task. If oom_lock is held by somebody else, a parallel oom
>
Powered by blists - more mailing lists