Index: linux-2.4.21-chaos/include/linux/mm.h =================================================================== --- linux-2.4.21-chaos.orig/include/linux/mm.h 2003-12-12 13:36:59.000000000 +0300 +++ linux-2.4.21-chaos/include/linux/mm.h 2003-12-12 16:15:57.000000000 +0300 @@ -843,6 +843,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_MEMALLOC 0x400 /* like PF_MEMALLOC: see __alloc_pages */ #define GFP_NOHIGHIO (__GFP_HIGH | __GFP_WAIT | __GFP_IO) #define GFP_NOIO (__GFP_HIGH | __GFP_WAIT) @@ -853,6 +854,7 @@ #define GFP_KERNEL (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) #define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) #define GFP_KSWAPD ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) +#define GFP_MEMALLOC __GFP_MEMALLOC /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some platforms, used as appropriate on others */ Index: linux-2.4.21-chaos/include/linux/slab.h =================================================================== --- linux-2.4.21-chaos.orig/include/linux/slab.h 2003-12-05 16:54:33.000000000 +0300 +++ linux-2.4.21-chaos/include/linux/slab.h 2003-12-12 16:15:57.000000000 +0300 @@ -23,6 +23,7 @@ #define SLAB_KERNEL GFP_KERNEL #define SLAB_NFS GFP_NFS #define SLAB_DMA GFP_DMA +#define SLAB_MEMALLOC GFP_MEMALLOC #define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHIO|__GFP_FS) #define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */ Index: linux-2.4.21-chaos/mm/page_alloc.c =================================================================== --- linux-2.4.21-chaos.orig/mm/page_alloc.c 2003-12-12 11:31:08.000000000 +0300 +++ linux-2.4.21-chaos/mm/page_alloc.c 2003-12-12 16:15:57.000000000 +0300 @@ -595,7 +595,8 @@ /* * Oh well, we didn't succeed. */ - if (!(current->flags & (PF_MEMALLOC|PF_MEMDIE))) { + if (!(current->flags & (PF_MEMALLOC|PF_MEMDIE)) && + !(gfp_mask & __GFP_MEMALLOC)) { /* * Are we dealing with a higher order allocation? * @@ -670,7 +671,9 @@ /* XXX: is pages_min/4 a good amount to reserve for this? */ min += z->pages_min / 4; - if (z->free_pages > min || ((current->flags & PF_MEMALLOC) && !in_interrupt())) { + if (z->free_pages > min || + (((current->flags & PF_MEMALLOC) || (gfp_mask & __GFP_MEMALLOC)) + && !in_interrupt())) { page = rmqueue(z, order); if (page) return page; Index: linux-2.4.21-chaos/mm/slab.c =================================================================== --- linux-2.4.21-chaos.orig/mm/slab.c 2003-12-05 07:55:51.000000000 +0300 +++ linux-2.4.21-chaos/mm/slab.c 2003-12-12 16:15:57.000000000 +0300 @@ -1125,7 +1125,7 @@ /* Be lazy and only check for valid flags here, * keeping it out of the critical path in kmem_cache_alloc(). */ - if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW)) + if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW|SLAB_MEMALLOC)) BUG(); if (flags & SLAB_NO_GROW) return 0;