Change the oom-killer so that it spits a sysrq-m output into the logs, and shows the gfp_mask of the failing allocation attempt. Signed-off-by: Andrew Morton --- 25-sparc64-akpm/include/linux/swap.h | 2 +- 25-sparc64-akpm/mm/oom_kill.c | 5 ++++- 25-sparc64-akpm/mm/vmscan.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff -puN include/linux/swap.h~oom-show_free_areas include/linux/swap.h --- 25-sparc64/include/linux/swap.h~oom-show_free_areas 2004-07-31 20:57:43.300677256 -0700 +++ 25-sparc64-akpm/include/linux/swap.h 2004-07-31 20:57:43.307676192 -0700 @@ -148,7 +148,7 @@ struct swap_list_t { #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) /* linux/mm/oom_kill.c */ -extern void out_of_memory(void); +extern void out_of_memory(int gfp_mask); /* linux/mm/memory.c */ extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); diff -puN mm/oom_kill.c~oom-show_free_areas mm/oom_kill.c --- 25-sparc64/mm/oom_kill.c~oom-show_free_areas 2004-07-31 20:57:43.302676952 -0700 +++ 25-sparc64-akpm/mm/oom_kill.c 2004-07-31 20:57:43.307676192 -0700 @@ -220,7 +220,7 @@ retry: /** * out_of_memory - is the system out of memory? */ -void out_of_memory(void) +void out_of_memory(int gfp_mask) { /* * oom_lock protects out_of_memory()'s static variables. @@ -271,6 +271,9 @@ void out_of_memory(void) */ lastkill = now; + printk("oom-killer: gfp_mask=0x%x\n", gfp_mask); + show_free_areas(); + /* oom_kill() sleeps */ spin_unlock(&oom_lock); oom_kill(); diff -puN mm/vmscan.c~oom-show_free_areas mm/vmscan.c --- 25-sparc64/mm/vmscan.c~oom-show_free_areas 2004-07-31 20:57:43.303676800 -0700 +++ 25-sparc64-akpm/mm/vmscan.c 2004-07-31 20:57:43.309675888 -0700 @@ -949,7 +949,7 @@ int try_to_free_pages(struct zone **zone blk_congestion_wait(WRITE, HZ/10); } if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) - out_of_memory(); + out_of_memory(gfp_mask); out: for (i = 0; zones[i] != 0; i++) zones[i]->prev_priority = zones[i]->temp_priority; _