Whamcloud - gitweb
- configurable stack size fo x86_64
[fs/lustre-release.git] / lustre / kernel_patches / patches / gfp_memalloc-2.4.20-rh.patch
1 Index: linux-2.4.20-rh-20.9/include/linux/mm.h
2 ===================================================================
3 --- linux-2.4.20-rh-20.9.orig/include/linux/mm.h        2003-11-13 17:35:48.000000000 +0300
4 +++ linux-2.4.20-rh-20.9/include/linux/mm.h     2003-11-17 15:50:22.000000000 +0300
5 @@ -713,6 +713,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 @@ -723,6 +724,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.20-rh-20.9/mm/page_alloc.c
22 ===================================================================
23 --- linux-2.4.20-rh-20.9.orig/mm/page_alloc.c   2003-11-13 17:20:37.000000000 +0300
24 +++ linux-2.4.20-rh-20.9/mm/page_alloc.c        2003-11-17 15:51:05.000000000 +0300
25 @@ -509,7 +509,8 @@
26         /*
27          * Oh well, we didn't succeed.
28          */
29 -       if (!(current->flags & (PF_MEMALLOC|PF_MEMDIE))) {
30 +       if (!(current->flags & (PF_MEMALLOC|PF_MEMDIE)) &&
31 +               !(gfp_mask & __GFP_MEMALLOC)) {
32                 /*
33                  * Are we dealing with a higher order allocation?
34                  *
35 @@ -583,7 +583,9 @@
36  
37                 /* XXX: is pages_min/4 a good amount to reserve for this? */
38                 min += z->pages_min / 4;
39 -               if (z->free_pages > min || ((current->flags & PF_MEMALLOC) && !in_interrupt())) {
40 +               if (z->free_pages > min ||
41 +                   (((current->flags & PF_MEMALLOC) || (gfp_mask & __GFP_MEMALLOC))
42 +                    && !in_interrupt())) {
43                         page = rmqueue(z, order);
44                         if (page)
45                                 return page;
46 Index: linux-2.4.20-rh-20.9/include/linux/slab.h
47 ===================================================================
48 --- linux-2.4.20-rh-20.9.orig/include/linux/slab.h      2003-11-13 17:35:48.000000000 +0300
49 +++ linux-2.4.20-rh-20.9/include/linux/slab.h   2003-11-17 15:50:22.000000000 +0300
50 @@ -23,6 +23,7 @@
51  #define        SLAB_KERNEL             GFP_KERNEL
52  #define        SLAB_NFS                GFP_NFS
53  #define        SLAB_DMA                GFP_DMA
54 +#define        SLAB_MEMALLOC           GFP_MEMALLOC
55  
56  #define SLAB_LEVEL_MASK                (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHIO|__GFP_FS)
57  #define        SLAB_NO_GROW            0x00001000UL    /* don't grow a cache */
58 Index: linux-2.4.20-rh-20.9/mm/slab.c
59 ===================================================================
60 --- linux-2.4.20-rh-20.9.orig/mm/slab.c 2003-09-13 19:34:24.000000000 +0400
61 +++ linux-2.4.20-rh-20.9/mm/slab.c      2003-11-17 15:50:22.000000000 +0300
62 @@ -1116,7 +1116,7 @@
63         /* Be lazy and only check for valid flags here,
64          * keeping it out of the critical path in kmem_cache_alloc().
65          */
66 -       if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW))
67 +       if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW|SLAB_MEMALLOC))
68                 BUG();
69         if (flags & SLAB_NO_GROW)
70                 return 0;