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>