--- /dev/null
+Index: linux-2.4.21-rhel/kernel/sysctl.c
+===================================================================
+--- linux-2.4.21-rhel.orig/kernel/sysctl.c 2005-01-20 18:52:39.000000000 -0700
++++ linux-2.4.21-rhel/kernel/sysctl.c 2005-05-31 18:47:22.000000000 -0600
+@@ -355,6 +355,8 @@
+ extern int skip_mapped_pages;
+
+ static ctl_table vm_table[] = {
++ {VM_GFP_DEBUG, "vm_gfp_debug",
++ &vm_gfp_debug, sizeof(int), 0644, NULL, &proc_dointvec},
+ {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0644, NULL,
+ &proc_dointvec_minmax, &sysctl_intvec, NULL,
+ &bdflush_min, &bdflush_max},
+Index: linux-2.4.21-rhel/mm/page_alloc.c
+===================================================================
+--- linux-2.4.21-rhel.orig/mm/page_alloc.c 2005-05-31 18:29:37.000000000 -0600
++++ linux-2.4.21-rhel/mm/page_alloc.c 2005-05-31 18:49:27.000000000 -0600
+@@ -58,6 +58,8 @@
+ static int zone_extrafree_max[MAX_NR_ZONES] __initdata = { 1024 , 1024, 0, };
+ #endif
+
++int vm_gfp_debug = 0;
++
+ /*
+ * Temporary debugging check.
+ */
+@@ -773,8 +775,12 @@
+ }
+
+ out_failed:
+- /* No luck.. */
+-// printk(KERN_ERR "__alloc_pages: %lu-order allocation failed.\n", order);
++ if (!(gfp_mask & __GFP_NOWARN)) {
++ printk(KERN_ERR "__alloc_pages: %lu-order allocation failed (gfp=%#x/%i).\n",
++ order, gfp_mask, !!(current->flags & PF_MEMALLOC));
++ if (unlikely(vm_gfp_debug))
++ dump_stack();
++ }
+ return NULL;
+ }
+
+Index: linux-2.4.21-rhel/include/linux/sysctl.h
+===================================================================
+--- linux-2.4.21-rhel.orig/include/linux/sysctl.h 2005-03-18 18:25:26.000000000 -0700
++++ linux-2.4.21-rhel/include/linux/sysctl.h 2005-05-31 18:48:17.000000000 -0600
+@@ -153,6 +153,7 @@
+ VM_MIN_READAHEAD=12, /* Min file readahead */
+ VM_MAX_READAHEAD=13, /* Max file readahead */
+ VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */
++ VM_GFP_DEBUG=18, /* debug GFP failures */
+ VM_PAGEBUF=22, /* struct: Control pagebuf parameters */
+ VM_HUGETLB_POOL=23, /* int: size of the hugetlb pool, in MB */
+ VM_DCACHE_PRIORITY=24, /* int: priority of the dcache pool */
+Index: linux-2.4.21-rhel/include/linux/mm.h
+===================================================================
+--- linux-2.4.21-rhel.orig/include/linux/mm.h 2005-05-31 18:50:32.000000000 -0600
++++ linux-2.4.21-rhel/include/linux/mm.h 2005-05-31 18:50:45.000000000 -0600
+@@ -846,6 +846,7 @@
+ #define __GFP_HIGHIO 0x80 /* Can start high mem physical IO? */
+ #define __GFP_FS 0x100 /* Can call down to low-level FS? */
+ #define __GFP_WIRED 0x200 /* Highmem bias and wired */
++#define __GFP_NOWARN 0x400 /* Don't report error on allocation failure */
+
+ #define GFP_NOHIGHIO (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
+ #define GFP_NOIO (__GFP_HIGH | __GFP_WAIT)
+Index: linux-2.4.21-rhel/include/linux/swap.h
+===================================================================
+--- linux-2.4.21-rhel.orig/include/linux/swap.h 2005-03-18 18:25:26.000000000 -0700
++++ linux-2.4.21-rhel/include/linux/swap.h 2005-05-31 18:52:44.000000000 -0600
+@@ -178,6 +178,7 @@
+ extern int rebalance_inactive(int);
+ extern void wakeup_kswapd(unsigned int);
+ extern void rss_free_pages(unsigned int);
++extern int vm_gfp_debug;
+
+ /*
+ * Limits, in percent, on how large the cache can be and how to do