Skip to content

Commit 578c2fd

Browse files
Janet MorganLinus Torvalds
authored andcommitted
[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: Janet Morgan <janetmor@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent c2f29ea commit 578c2fd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mm/oom_kill.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ void out_of_memory(unsigned int __nocast gfp_mask)
258258
struct mm_struct *mm = NULL;
259259
task_t * p;
260260

261+
printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
262+
/* print memory stats */
263+
show_mem();
264+
261265
read_lock(&tasklist_lock);
262266
retry:
263267
p = select_bad_process();
@@ -268,12 +272,9 @@ void out_of_memory(unsigned int __nocast gfp_mask)
268272
/* Found nothing?!?! Either we hang forever, or we panic. */
269273
if (!p) {
270274
read_unlock(&tasklist_lock);
271-
show_free_areas();
272275
panic("Out of memory and no killable processes...\n");
273276
}
274277

275-
printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
276-
show_free_areas();
277278
mm = oom_kill_process(p);
278279
if (!mm)
279280
goto retry;

mm/page_alloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ __alloc_pages(unsigned int __nocast gfp_mask, unsigned int order,
935935
" order:%d, mode:0x%x\n",
936936
p->comm, order, gfp_mask);
937937
dump_stack();
938+
show_mem();
938939
}
939940
return NULL;
940941
got_pg:

0 commit comments

Comments
 (0)