Skip to content

Commit

Permalink
[PATCH] add OOM debug
Browse files Browse the repository at this point in the history
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: Janet Morgan <janetmor@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Janet Morgan authored and Linus Torvalds committed Jun 22, 2005
1 parent c2f29ea commit 578c2fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ void out_of_memory(unsigned int __nocast gfp_mask)
struct mm_struct *mm = NULL;
task_t * p;

printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
/* print memory stats */
show_mem();

read_lock(&tasklist_lock);
retry:
p = select_bad_process();
Expand All @@ -268,12 +272,9 @@ void out_of_memory(unsigned int __nocast gfp_mask)
/* Found nothing?!?! Either we hang forever, or we panic. */
if (!p) {
read_unlock(&tasklist_lock);
show_free_areas();
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);
if (!mm)
goto retry;
Expand Down
1 change: 1 addition & 0 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ __alloc_pages(unsigned int __nocast gfp_mask, unsigned int order,
" order:%d, mode:0x%x\n",
p->comm, order, gfp_mask);
dump_stack();
show_mem();
}
return NULL;
got_pg:
Expand Down

0 comments on commit 578c2fd

Please sign in to comment.