Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / gfp_debug-2.4.21-rhel.patch
1 Index: linux-2.4.21-rhel/kernel/sysctl.c
2 ===================================================================
3 --- linux-2.4.21-rhel.orig/kernel/sysctl.c      2005-01-20 18:52:39.000000000 -0700
4 +++ linux-2.4.21-rhel/kernel/sysctl.c   2005-05-31 18:47:22.000000000 -0600
5 @@ -355,6 +355,8 @@
6  extern int skip_mapped_pages;
7  
8  static ctl_table vm_table[] = {
9 +       {VM_GFP_DEBUG, "vm_gfp_debug",
10 +        &vm_gfp_debug, sizeof(int), 0644, NULL, &proc_dointvec},
11         {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0644, NULL,
12          &proc_dointvec_minmax, &sysctl_intvec, NULL,
13          &bdflush_min, &bdflush_max},
14 Index: linux-2.4.21-rhel/mm/page_alloc.c
15 ===================================================================
16 --- linux-2.4.21-rhel.orig/mm/page_alloc.c      2005-05-31 18:29:37.000000000 -0600
17 +++ linux-2.4.21-rhel/mm/page_alloc.c   2005-05-31 18:49:27.000000000 -0600
18 @@ -58,6 +58,8 @@
19  static int zone_extrafree_max[MAX_NR_ZONES] __initdata = { 1024 , 1024, 0, };
20  #endif
21  
22 +int vm_gfp_debug = 0;
23 +
24  /*
25   * Temporary debugging check.
26   */
27 @@ -773,8 +775,12 @@
28         }
29  
30  out_failed:
31 -       /* No luck.. */
32 -//     printk(KERN_ERR "__alloc_pages: %lu-order allocation failed.\n", order);
33 +       if (!(gfp_mask & __GFP_NOWARN)) {
34 +               printk(KERN_ERR "__alloc_pages: %lu-order allocation failed (gfp=%#x/%i).\n",
35 +                      order, gfp_mask, !!(current->flags & PF_MEMALLOC));
36 +               if (unlikely(vm_gfp_debug))
37 +                       dump_stack();
38 +       }
39         return NULL;
40  }
41  
42 Index: linux-2.4.21-rhel/include/linux/sysctl.h
43 ===================================================================
44 --- linux-2.4.21-rhel.orig/include/linux/sysctl.h       2005-03-18 18:25:26.000000000 -0700
45 +++ linux-2.4.21-rhel/include/linux/sysctl.h    2005-05-31 18:48:17.000000000 -0600
46 @@ -153,6 +153,7 @@
47         VM_MIN_READAHEAD=12,    /* Min file readahead */
48         VM_MAX_READAHEAD=13,    /* Max file readahead */
49         VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */
50 +       VM_GFP_DEBUG=18,        /* debug GFP failures */
51         VM_PAGEBUF=22,          /* struct: Control pagebuf parameters */
52         VM_HUGETLB_POOL=23,     /* int: size of the hugetlb pool, in MB */
53         VM_DCACHE_PRIORITY=24,  /* int: priority of the dcache pool */
54 Index: linux-2.4.21-rhel/include/linux/mm.h
55 ===================================================================
56 --- linux-2.4.21-rhel.orig/include/linux/mm.h   2005-05-31 18:50:32.000000000 -0600
57 +++ linux-2.4.21-rhel/include/linux/mm.h        2005-05-31 18:50:45.000000000 -0600
58 @@ -846,6 +846,7 @@
59  #define __GFP_HIGHIO   0x80    /* Can start high mem physical IO? */
60  #define __GFP_FS       0x100   /* Can call down to low-level FS? */
61  #define __GFP_WIRED    0x200   /* Highmem bias and wired */
62 +#define __GFP_NOWARN   0x400   /* Don't report error on allocation failure */
63  
64  #define GFP_NOHIGHIO   (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
65  #define GFP_NOIO       (__GFP_HIGH | __GFP_WAIT)
66 Index: linux-2.4.21-rhel/include/linux/swap.h
67 ===================================================================
68 --- linux-2.4.21-rhel.orig/include/linux/swap.h 2005-03-18 18:25:26.000000000 -0700
69 +++ linux-2.4.21-rhel/include/linux/swap.h      2005-05-31 18:52:44.000000000 -0600
70 @@ -178,6 +178,7 @@
71  extern int rebalance_inactive(int);
72  extern void wakeup_kswapd(unsigned int);
73  extern void rss_free_pages(unsigned int);
74 +extern int vm_gfp_debug;
75  
76  /*
77   * Limits, in percent, on how large the cache can be and how to do