Commit 7213f5066fc8a17c78389fe245de522b5cf0648a

Authored by David Rientjes
Committed by Linus Torvalds
1 parent fe071d7e8a

oom: suppress extraneous stack and memory dump

Suppresses the extraneous stack and memory dump when a parallel OOM killing
has been found.  There's no need to fill the ring buffer with this information
if its already been printed and the condition that triggered the previous OOM
killer has not yet been alleviated.

Cc: Andrea Arcangeli <andrea@suse.de>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 14 additions and 13 deletions Side-by-side Diff

... ... @@ -333,12 +333,20 @@
333 333 return 0;
334 334 }
335 335  
336   -static int oom_kill_process(struct task_struct *p, unsigned long points,
337   - const char *message)
  336 +static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
  337 + unsigned long points, const char *message)
338 338 {
339 339 struct task_struct *c;
340 340 struct list_head *tsk;
341 341  
  342 + if (printk_ratelimit()) {
  343 + printk(KERN_WARNING "%s invoked oom-killer: "
  344 + "gfp_mask=0x%x, order=%d, oomkilladj=%d\n",
  345 + current->comm, gfp_mask, order, current->oomkilladj);
  346 + dump_stack();
  347 + show_mem();
  348 + }
  349 +
342 350 /*
343 351 * If the task is already exiting, don't alarm the sysadmin or kill
344 352 * its children or threads, just set TIF_MEMDIE so it can die quickly
... ... @@ -447,14 +455,6 @@
447 455 /* Got some memory back in the last second. */
448 456 return;
449 457  
450   - if (printk_ratelimit()) {
451   - printk(KERN_WARNING "%s invoked oom-killer: "
452   - "gfp_mask=0x%x, order=%d, oomkilladj=%d\n",
453   - current->comm, gfp_mask, order, current->oomkilladj);
454   - dump_stack();
455   - show_mem();
456   - }
457   -
458 458 if (sysctl_panic_on_oom == 2)
459 459 panic("out of memory. Compulsory panic_on_oom is selected.\n");
460 460  
... ... @@ -468,7 +468,7 @@
468 468  
469 469 switch (constraint) {
470 470 case CONSTRAINT_MEMORY_POLICY:
471   - oom_kill_process(current, points,
  471 + oom_kill_process(current, gfp_mask, order, points,
472 472 "No available memory (MPOL_BIND)");
473 473 break;
474 474  
... ... @@ -478,7 +478,7 @@
478 478 /* Fall-through */
479 479 case CONSTRAINT_CPUSET:
480 480 if (sysctl_oom_kill_allocating_task) {
481   - oom_kill_process(current, points,
  481 + oom_kill_process(current, gfp_mask, order, points,
482 482 "Out of memory (oom_kill_allocating_task)");
483 483 break;
484 484 }
... ... @@ -499,7 +499,8 @@
499 499 panic("Out of memory and no killable processes...\n");
500 500 }
501 501  
502   - if (oom_kill_process(p, points, "Out of memory"))
  502 + if (oom_kill_process(p, points, gfp_mask, order,
  503 + "Out of memory"))
503 504 goto retry;
504 505  
505 506 break;