From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>

Dump the current allocation order when OOM killing.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/linux/swap.h |    2 +-
 mm/oom_kill.c        |    4 ++--
 mm/page_alloc.c      |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff -puN include/linux/swap.h~print-order-information-when-oom-killing include/linux/swap.h
--- devel/include/linux/swap.h~print-order-information-when-oom-killing	2005-07-06 01:50:40.000000000 -0700
+++ devel-akpm/include/linux/swap.h	2005-07-06 01:51:47.000000000 -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(unsigned int __nocast gfp_mask);
+extern void out_of_memory(unsigned int __nocast gfp_mask, int order);
 
 /* linux/mm/memory.c */
 extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
diff -puN mm/oom_kill.c~print-order-information-when-oom-killing mm/oom_kill.c
--- devel/mm/oom_kill.c~print-order-information-when-oom-killing	2005-07-06 01:50:40.000000000 -0700
+++ devel-akpm/mm/oom_kill.c	2005-07-06 01:51:26.000000000 -0700
@@ -253,12 +253,12 @@ static struct mm_struct *oom_kill_proces
  * OR try to be smart about which process to kill. Note that we
  * don't have to be perfect here, we just have to be good.
  */
-void out_of_memory(unsigned int __nocast gfp_mask)
+void out_of_memory(unsigned int __nocast gfp_mask, int order)
 {
 	struct mm_struct *mm = NULL;
 	task_t * p;
 
-	printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
+	printk("oom-killer: gfp_mask=0x%x, order=%d\n", gfp_mask, order);
 	/* print memory stats */
 	show_mem();
 
diff -puN mm/page_alloc.c~print-order-information-when-oom-killing mm/page_alloc.c
--- devel/mm/page_alloc.c~print-order-information-when-oom-killing	2005-07-06 01:50:40.000000000 -0700
+++ devel-akpm/mm/page_alloc.c	2005-07-06 01:50:40.000000000 -0700
@@ -936,7 +936,7 @@ rebalance:
 				goto got_pg;
 		}
 
-		out_of_memory(gfp_mask);
+		out_of_memory(gfp_mask, order);
 		goto restart;
 	}
 
_