Re: [PATCH -mm] Kill existing current task quickly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> Cc: Nick Piggin <npiggin@xxxxxxx>
> ---
>  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).

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]