lkml.org 
[lkml]   [2010]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -mm] Kill existing current task quickly
On Wed, 17 Feb 2010, Minchan Kim wrote:

> If we found current task is existing but didn't set TIF_MEMDIE
> during OOM victim selection, let's stop unnecessary looping for
> getting high badness score task and go ahead for killing current.
>
> This patch would make side effect skip OOM_DISABLE test.
> But It's okay since the task is existing and oom_kill_process
> doesn't show any killing message since __oom_kill_task will
> interrupt it in oom_kill_process.
>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Cc: Nick Piggin <npiggin@suse.de>
> ---
> mm/oom_kill.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 3618be3..5c21398 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -295,6 +295,7 @@ static struct task_struct
> *select_bad_process(unsigned long *ppoints,
>
> chosen = p;
> *ppoints = ULONG_MAX;
> + break;
> }
>
> if (p->signal->oom_adj == OOM_DISABLE)

No, we don't want to break because there may be other candidate tasks that
have TIF_MEMDIE set that will be detected if we keep scanning. Returning
ERR_PTR(-1UL) from select_bad_process() has a special meaning: it means we
return to the page allocator without doing anything. We don't want more
than one candidate task to ever have TIF_MEMDIE at a time, otherwise they
can deplete all memory reserves and not make any forward progress. So we
always have to iterate the entire tasklist unless we find an already oom
killed task with access to memory reserves (to prevent needlessly killing
additional tasks before the first had a chance to exit and free its
memory) or a different candidate task is exiting so we'll be freeing
memory shortly (or it will be invoking the oom killer itself as current
and then get chosen as the victim).


\
 
 \ /
  Last update: 2010-02-16 23:05    [W:0.051 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site