Re: [patch v2 1/2] oom: avoid killing a task if a thread sharing its mm cannot be killed

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

 



On Wed, 18 Aug 2010, KAMEZAWA Hiroyuki wrote:

> > The oom killer's goal is to kill a memory-hogging task so that it may
> > exit, free its memory, and allow the current context to allocate the
> > memory that triggered it in the first place.  Thus, killing a task is
> > pointless if other threads sharing its mm cannot be killed because of its
> > /proc/pid/oom_adj or /proc/pid/oom_score_adj value.
> > 
> > This patch checks all user threads on the system to determine whether
> > oom_badness(p) should return 0 for p, which means it should not be killed.
> > If a thread shares p's mm and is unkillable, p is considered to be
> > unkillable as well.
> > 
> > Kthreads are not considered toward this rule since they only temporarily
> > assume a task's mm via use_mm().
> > 
> > Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
> 
> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
> 

Thanks!

> Thank you. BTW, do you have good idea for speed-up ?
> This code seems terribly slow when a system has many processes.
> 

I was thinking about adding an "unsinged long oom_kill_disable_count" to 
struct mm_struct that would atomically increment anytime a task attached 
to it had a signal->oom_score_adj of OOM_SCORE_ADJ_MIN.

The proc handler when changing /proc/pid/oom_score_adj would inc or dec 
the counter depending on the new value, and exit_mm() would dec the 
counter if current->signal->oom_score_adj is OOM_SCORE_ADJ_MIN.

What do you think?

--
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]