Whamcloud - gitweb
a8489e6239ad9559c65683a09c122f3a606d9659
[fs/lustre-release.git] / lustre / kernel_patches / patches / gfp_memalloc-2.4.18-chaos.patch
1 Index: linux-2.4.18-chaos/include/linux/mm.h
2 ===================================================================
3 --- linux-2.4.18-chaos.orig/include/linux/mm.h  2003-11-13 17:06:48.000000000 +0300
4 +++ linux-2.4.18-chaos/include/linux/mm.h       2003-11-17 15:46:32.000000000 +0300
5 @@ -677,6 +677,7 @@
6  #define __GFP_IO       0x40    /* Can start low memory physical IO? */
7  #define __GFP_HIGHIO   0x80    /* Can start high mem physical IO? */
8  #define __GFP_FS       0x100   /* Can call down to low-level FS? */
9 +#define __GFP_MEMALLOC 0x200   /* like PF_MEMALLOC: see __alloc_pages */
10  
11  #define GFP_NOHIGHIO   (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
12  #define GFP_NOIO       (__GFP_HIGH | __GFP_WAIT)
13 @@ -687,6 +688,7 @@
14  #define GFP_KERNEL     (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS)
15  #define GFP_NFS                (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS)
16  #define GFP_KSWAPD     (             __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS)
17 +#define GFP_MEMALLOC   __GFP_MEMALLOC
18  
19  /* Flag - indicates that the buffer will be suitable for DMA.  Ignored on some
20     platforms, used as appropriate on others */
21 Index: linux-2.4.18-chaos/mm/page_alloc.c
22 ===================================================================
23 --- linux-2.4.18-chaos.orig/mm/page_alloc.c     2003-11-13 17:06:47.000000000 +0300
24 +++ linux-2.4.18-chaos/mm/page_alloc.c  2003-11-17 15:49:11.000000000 +0300
25 @@ -554,7 +554,7 @@
26         /*
27          * Oh well, we didn't succeed.
28          */
29 -       if (!(current->flags & PF_MEMALLOC)) {
30 +       if (!(current->flags & PF_MEMALLOC) && !(gfp_mask & __GFP_MEMALLOC)) {
31                 /*
32                  * Are we dealing with a higher order allocation?
33                  *
34 Index: linux-2.4.18-chaos/include/linux/slab.h
35 ===================================================================
36 --- linux-2.4.18-chaos.orig/include/linux/slab.h        2003-07-28 17:52:18.000000000 +0400
37 +++ linux-2.4.18-chaos/include/linux/slab.h     2003-11-17 15:46:32.000000000 +0300
38 @@ -23,6 +23,7 @@
39  #define        SLAB_KERNEL             GFP_KERNEL
40  #define        SLAB_NFS                GFP_NFS
41  #define        SLAB_DMA                GFP_DMA
42 +#define        SLAB_MEMALLOC           GFP_MEMALLOC
43  
44  #define SLAB_LEVEL_MASK                (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHIO|__GFP_FS)
45  #define        SLAB_NO_GROW            0x00001000UL    /* don't grow a cache */
46 Index: linux-2.4.18-chaos/mm/slab.c
47 ===================================================================
48 --- linux-2.4.18-chaos.orig/mm/slab.c   2003-07-28 17:52:20.000000000 +0400
49 +++ linux-2.4.18-chaos/mm/slab.c        2003-11-17 15:46:32.000000000 +0300
50 @@ -1116,7 +1116,7 @@
51         /* Be lazy and only check for valid flags here,
52          * keeping it out of the critical path in kmem_cache_alloc().
53          */
54 -       if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW))
55 +       if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW|SLAB_MEMALLOC))
56                 BUG();
57         if (flags & SLAB_NO_GROW)
58                 return 0;