Skip to contentSkip to conversation

implement __GFP_REPEAT, __GFP_NOFAIL, __GFP_NORETRY

PATCH Alexey Mahotkin 2 participants 2 messages Apr 22, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Maybe I am wrong, but recent patch added

+#define __GFP_NORETRY 0x1000 /* Do not retry. Might fail */

which conflicts numerically with

#define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */

e.g., mm/slab.c contains the following snippet:

if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW))
BUG();
if (flags & SLAB_NO_GROW)
return 0;

while SLAB_LEVEL_MASK actually contains SLAB_NO_GROW.

--alexm

#1 lore raw
Quoted 13 lines · Alexey Mahotkin

Maybe I am wrong, but recent patch added

+#define __GFP_NORETRY 0x1000 /* Do not retry. Might fail */

which conflicts numerically with

#define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */

Quoted 7 lines

e.g., mm/slab.c contains the following snippet:

if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW))
BUG();
if (flags & SLAB_NO_GROW)
return 0;

Well spotted, thanks. This should fix it up:

include/linux/slab.h renamed from include/linux/slab.h~SLAB_NO_GROW-fix +5 -2
diff -puN include/linux/slab.h~SLAB_NO_GROW-fix include/linux/slab.h
@@ -22,8 +22,11 @@ typedef struct kmem_cache_s kmem_cache_t
 #define	SLAB_KERNEL		GFP_KERNEL
 #define	SLAB_DMA		GFP_DMA
 
-#define SLAB_LEVEL_MASK		(__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS|__GFP_COLD|__GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|__GFP_NORETRY)
-#define	SLAB_NO_GROW		0x00001000UL	/* don't grow a cache */
+#define SLAB_LEVEL_MASK		(__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS|\
+				__GFP_COLD|__GFP_NOWARN|__GFP_REPEAT|\
+				__GFP_NOFAIL|__GFP_NORETRY)
+
+#define	SLAB_NO_GROW		__GFP_NO_GROW	/* don't grow a cache */
 
 /* flags to pass to kmem_cache_create().
  * The first 3 are only valid when the allocator as been build
include/linux/gfp.h renamed from include/linux/gfp.h~SLAB_NO_GROW-fix +1 -0
diff -puN include/linux/gfp.h~SLAB_NO_GROW-fix include/linux/gfp.h
@@ -31,6 +31,7 @@
 #define __GFP_REPEAT	0x400	/* Retry the allocation.  Might fail */
 #define __GFP_NOFAIL	0x800	/* Retry for ever.  Cannot fail */
 #define __GFP_NORETRY	0x1000	/* Do not retry.  Might fail */
+#define __GFP_NO_GROW	0x2000	/* Internal slab usage */
 
 #define GFP_ATOMIC	(__GFP_HIGH)
 #define GFP_NOIO	(__GFP_WAIT)

_