Whamcloud - gitweb
land v0.9.1 on HEAD, in preparation for a 1.0.x branch
[fs/lustre-release.git] / lustre / kernel_patches / patches / gfp_memalloc-2.4.22.patch
1 Index: linux-2.4.22-vanilla/include/linux/mm.h
2 ===================================================================
3 --- linux-2.4.22-vanilla.orig/include/linux/mm.h        2003-11-17 15:26:32.000000000 +0300
4 +++ linux-2.4.22-vanilla/include/linux/mm.h     2003-11-17 15:40:32.000000000 +0300
5 @@ -612,6 +612,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 @@ -622,6 +623,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.22-vanilla/mm/page_alloc.c
22 ===================================================================
23 --- linux-2.4.22-vanilla.orig/mm/page_alloc.c   2003-11-13 18:19:51.000000000 +0300
24 +++ linux-2.4.22-vanilla/mm/page_alloc.c        2003-11-17 15:40:32.000000000 +0300
25 @@ -377,7 +377,8 @@
26         /* here we're in the low on memory slow path */
27  
28  rebalance:
29 -       if (current->flags & (PF_MEMALLOC | PF_MEMDIE)) {
30 +       if (current->flags & (PF_MEMALLOC | PF_MEMDIE) || 
31 +                       gfp_mask & __GFP_MEMALLOC) {
32                 zone = zonelist->zones;
33                 for (;;) {
34                         zone_t *z = *(zone++);
35 Index: linux-2.4.22-vanilla/include/linux/slab.h
36 ===================================================================
37 --- linux-2.4.22-vanilla.orig/include/linux/slab.h      2003-11-17 14:58:37.000000000 +0300
38 +++ linux-2.4.22-vanilla/include/linux/slab.h   2003-11-17 15:42:13.000000000 +0300
39 @@ -23,6 +23,7 @@
40  #define        SLAB_KERNEL             GFP_KERNEL
41  #define        SLAB_NFS                GFP_NFS
42  #define        SLAB_DMA                GFP_DMA
43 +#define        SLAB_MEMALLOC           GFP_MEMALLOC
44  
45  #define SLAB_LEVEL_MASK                (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHIO|__GFP_FS)
46  #define        SLAB_NO_GROW            0x00001000UL    /* don't grow a cache */
47 Index: linux-2.4.22-vanilla/mm/slab.c
48 ===================================================================
49 --- linux-2.4.22-vanilla.orig/mm/slab.c 2003-11-13 17:39:29.000000000 +0300
50 +++ linux-2.4.22-vanilla/mm/slab.c      2003-11-17 15:42:13.000000000 +0300
51 @@ -1115,7 +1115,7 @@
52         /* Be lazy and only check for valid flags here,
53          * keeping it out of the critical path in kmem_cache_alloc().
54          */
55 -       if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW))
56 +       if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW|SLAB_MEMALLOC))
57                 BUG();
58         if (flags & SLAB_NO_GROW)
59                 return 0;