diff options
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index bc2627deb7f9..a6879f22eb30 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -264,7 +264,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) | |||
264 | * flag though it's unlikely that we select a process with CAP_SYS_RAW_IO | 264 | * flag though it's unlikely that we select a process with CAP_SYS_RAW_IO |
265 | * set. | 265 | * set. |
266 | */ | 266 | */ |
267 | static void __oom_kill_task(struct task_struct *p, const char *message) | 267 | static void __oom_kill_task(struct task_struct *p, int verbose) |
268 | { | 268 | { |
269 | if (is_init(p)) { | 269 | if (is_init(p)) { |
270 | WARN_ON(1); | 270 | WARN_ON(1); |
@@ -278,10 +278,8 @@ static void __oom_kill_task(struct task_struct *p, const char *message) | |||
278 | return; | 278 | return; |
279 | } | 279 | } |
280 | 280 | ||
281 | if (message) { | 281 | if (verbose) |
282 | printk(KERN_ERR "%s: Killed process %d (%s).\n", | 282 | printk(KERN_ERR "Killed process %d (%s)\n", p->pid, p->comm); |
283 | message, p->pid, p->comm); | ||
284 | } | ||
285 | 283 | ||
286 | /* | 284 | /* |
287 | * We give our sacrificial lamb high priority and access to | 285 | * We give our sacrificial lamb high priority and access to |
@@ -294,7 +292,7 @@ static void __oom_kill_task(struct task_struct *p, const char *message) | |||
294 | force_sig(SIGKILL, p); | 292 | force_sig(SIGKILL, p); |
295 | } | 293 | } |
296 | 294 | ||
297 | static int oom_kill_task(struct task_struct *p, const char *message) | 295 | static int oom_kill_task(struct task_struct *p) |
298 | { | 296 | { |
299 | struct mm_struct *mm; | 297 | struct mm_struct *mm; |
300 | struct task_struct *g, *q; | 298 | struct task_struct *g, *q; |
@@ -321,15 +319,15 @@ static int oom_kill_task(struct task_struct *p, const char *message) | |||
321 | return 1; | 319 | return 1; |
322 | } while_each_thread(g, q); | 320 | } while_each_thread(g, q); |
323 | 321 | ||
324 | __oom_kill_task(p, message); | 322 | __oom_kill_task(p, 1); |
325 | 323 | ||
326 | /* | 324 | /* |
327 | * kill all processes that share the ->mm (i.e. all threads), | 325 | * kill all processes that share the ->mm (i.e. all threads), |
328 | * but are in a different thread group | 326 | * but are in a different thread group. |
329 | */ | 327 | */ |
330 | do_each_thread(g, q) { | 328 | do_each_thread(g, q) { |
331 | if (q->mm == mm && q->tgid != p->tgid) | 329 | if (q->mm == mm && q->tgid != p->tgid) |
332 | __oom_kill_task(q, message); | 330 | __oom_kill_task(q, 1); |
333 | } while_each_thread(g, q); | 331 | } while_each_thread(g, q); |
334 | 332 | ||
335 | return 0; | 333 | return 0; |
@@ -346,21 +344,22 @@ static int oom_kill_process(struct task_struct *p, unsigned long points, | |||
346 | * its children or threads, just set TIF_MEMDIE so it can die quickly | 344 | * its children or threads, just set TIF_MEMDIE so it can die quickly |
347 | */ | 345 | */ |
348 | if (p->flags & PF_EXITING) { | 346 | if (p->flags & PF_EXITING) { |
349 | __oom_kill_task(p, NULL); | 347 | __oom_kill_task(p, 0); |
350 | return 0; | 348 | return 0; |
351 | } | 349 | } |
352 | 350 | ||
353 | printk(KERN_ERR "Out of Memory: Kill process %d (%s) score %li" | 351 | printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n", |
354 | " and children.\n", p->pid, p->comm, points); | 352 | message, p->pid, p->comm, points); |
353 | |||
355 | /* Try to kill a child first */ | 354 | /* Try to kill a child first */ |
356 | list_for_each(tsk, &p->children) { | 355 | list_for_each(tsk, &p->children) { |
357 | c = list_entry(tsk, struct task_struct, sibling); | 356 | c = list_entry(tsk, struct task_struct, sibling); |
358 | if (c->mm == p->mm) | 357 | if (c->mm == p->mm) |
359 | continue; | 358 | continue; |
360 | if (!oom_kill_task(c, message)) | 359 | if (!oom_kill_task(c)) |
361 | return 0; | 360 | return 0; |
362 | } | 361 | } |
363 | return oom_kill_task(p, message); | 362 | return oom_kill_task(p); |
364 | } | 363 | } |
365 | 364 | ||
366 | static BLOCKING_NOTIFIER_HEAD(oom_notify_list); | 365 | static BLOCKING_NOTIFIER_HEAD(oom_notify_list); |