Commit 578c2fd6 authored by Janet Morgan's avatar Janet Morgan Committed by Linus Torvalds

[PATCH] add OOM debug

This patch provides more debug info when the system is OOM.  It displays
memory stats (basically sysrq-m info) from __alloc_pages() when page
allocation fails and during OOM kill.

Thanks to Dave Jones for coming up with the idea.
Signed-off-by: default avatarJanet Morgan <janetmor@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c2f29ea1
...@@ -258,6 +258,10 @@ void out_of_memory(unsigned int __nocast gfp_mask) ...@@ -258,6 +258,10 @@ void out_of_memory(unsigned int __nocast gfp_mask)
struct mm_struct *mm = NULL; struct mm_struct *mm = NULL;
task_t * p; task_t * p;
printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
/* print memory stats */
show_mem();
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
retry: retry:
p = select_bad_process(); p = select_bad_process();
...@@ -268,12 +272,9 @@ retry: ...@@ -268,12 +272,9 @@ retry:
/* Found nothing?!?! Either we hang forever, or we panic. */ /* Found nothing?!?! Either we hang forever, or we panic. */
if (!p) { if (!p) {
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
show_free_areas();
panic("Out of memory and no killable processes...\n"); panic("Out of memory and no killable processes...\n");
} }
printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
show_free_areas();
mm = oom_kill_process(p); mm = oom_kill_process(p);
if (!mm) if (!mm)
goto retry; goto retry;
......
...@@ -935,6 +935,7 @@ nopage: ...@@ -935,6 +935,7 @@ nopage:
" order:%d, mode:0x%x\n", " order:%d, mode:0x%x\n",
p->comm, order, gfp_mask); p->comm, order, gfp_mask);
dump_stack(); dump_stack();
show_mem();
} }
return NULL; return NULL;
got_pg: got_pg:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment