diff options
author | Nick Piggin <npiggin@suse.de> | 2006-12-06 23:31:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:20 -0500 |
commit | c33e0fca3508f0aa387b1c10d0ef158102deb140 (patch) | |
tree | d4dbbddbcd7cdf605dc5c0c97088789c7e10f4b4 | |
parent | 7253f4ef04b1cd138baf2b29a95473743ac0a307 (diff) |
[PATCH] oom: don't kill unkillable children or siblings
Abort the kill if any of our threads have OOM_DISABLE set. Having this
test here also prevents any OOM_DISABLE child of the "selected" process
from being killed.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/oom_kill.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 2e3ce3a928b9..bc2627deb7f9 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -313,15 +313,24 @@ static int oom_kill_task(struct task_struct *p, const char *message) | |||
313 | if (mm == NULL) | 313 | if (mm == NULL) |
314 | return 1; | 314 | return 1; |
315 | 315 | ||
316 | /* | ||
317 | * Don't kill the process if any threads are set to OOM_DISABLE | ||
318 | */ | ||
319 | do_each_thread(g, q) { | ||
320 | if (q->mm == mm && p->oomkilladj == OOM_DISABLE) | ||
321 | return 1; | ||
322 | } while_each_thread(g, q); | ||
323 | |||
316 | __oom_kill_task(p, message); | 324 | __oom_kill_task(p, message); |
325 | |||
317 | /* | 326 | /* |
318 | * kill all processes that share the ->mm (i.e. all threads), | 327 | * kill all processes that share the ->mm (i.e. all threads), |
319 | * but are in a different thread group | 328 | * but are in a different thread group |
320 | */ | 329 | */ |
321 | do_each_thread(g, q) | 330 | do_each_thread(g, q) { |
322 | if (q->mm == mm && q->tgid != p->tgid) | 331 | if (q->mm == mm && q->tgid != p->tgid) |
323 | __oom_kill_task(q, message); | 332 | __oom_kill_task(q, message); |
324 | while_each_thread(g, q); | 333 | } while_each_thread(g, q); |
325 | 334 | ||
326 | return 0; | 335 | return 0; |
327 | } | 336 | } |