diff options
-rw-r--r-- | mm/oom_kill.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 00d0bd7d6a2b..5c5aa7380bd1 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -333,12 +333,20 @@ static int oom_kill_task(struct task_struct *p) | |||
333 | return 0; | 333 | return 0; |
334 | } | 334 | } |
335 | 335 | ||
336 | static int oom_kill_process(struct task_struct *p, unsigned long points, | 336 | static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, |
337 | const char *message) | 337 | unsigned long points, const char *message) |
338 | { | 338 | { |
339 | struct task_struct *c; | 339 | struct task_struct *c; |
340 | struct list_head *tsk; | 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 | * If the task is already exiting, don't alarm the sysadmin or kill | 351 | * If the task is already exiting, don't alarm the sysadmin or kill |
344 | * its children or threads, just set TIF_MEMDIE so it can die quickly | 352 | * its children or threads, just set TIF_MEMDIE so it can die quickly |
@@ -447,14 +455,6 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) | |||
447 | /* Got some memory back in the last second. */ | 455 | /* Got some memory back in the last second. */ |
448 | return; | 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 | if (sysctl_panic_on_oom == 2) | 458 | if (sysctl_panic_on_oom == 2) |
459 | panic("out of memory. Compulsory panic_on_oom is selected.\n"); | 459 | panic("out of memory. Compulsory panic_on_oom is selected.\n"); |
460 | 460 | ||
@@ -468,7 +468,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) | |||
468 | 468 | ||
469 | switch (constraint) { | 469 | switch (constraint) { |
470 | case CONSTRAINT_MEMORY_POLICY: | 470 | case CONSTRAINT_MEMORY_POLICY: |
471 | oom_kill_process(current, points, | 471 | oom_kill_process(current, gfp_mask, order, points, |
472 | "No available memory (MPOL_BIND)"); | 472 | "No available memory (MPOL_BIND)"); |
473 | break; | 473 | break; |
474 | 474 | ||
@@ -478,7 +478,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) | |||
478 | /* Fall-through */ | 478 | /* Fall-through */ |
479 | case CONSTRAINT_CPUSET: | 479 | case CONSTRAINT_CPUSET: |
480 | if (sysctl_oom_kill_allocating_task) { | 480 | if (sysctl_oom_kill_allocating_task) { |
481 | oom_kill_process(current, points, | 481 | oom_kill_process(current, gfp_mask, order, points, |
482 | "Out of memory (oom_kill_allocating_task)"); | 482 | "Out of memory (oom_kill_allocating_task)"); |
483 | break; | 483 | break; |
484 | } | 484 | } |
@@ -499,7 +499,8 @@ retry: | |||
499 | panic("Out of memory and no killable processes...\n"); | 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 | goto retry; | 504 | goto retry; |
504 | 505 | ||
505 | break; | 506 | break; |