aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-10-16 04:25:41 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:42:59 -0400
commit6cb062296f73e74768cca2f3eaf90deac54de02d (patch)
tree1572139653a6fc97cdffd06f2c1bfa650da2ce03 /include
parent58c0a4a7864b2dad6da4090813322fcd29a11c92 (diff)
Categorize GFP flags
The function of GFP_LEVEL_MASK seems to be unclear. In order to clear up the mystery we get rid of it and replace GFP_LEVEL_MASK with 3 sets of GFP flags: GFP_RECLAIM_MASK Flags used to control page allocator reclaim behavior. GFP_CONSTRAINT_MASK Flags used to limit where allocations can occur. GFP_SLAB_BUG_MASK Flags that the slab allocator BUG()s on. These replace the uses of GFP_LEVEL mask in the slab allocators and in vmalloc.c. The use of the flags not included in these sets may occur as a result of a slab allocation standing in for a page allocation when constructing scatter gather lists. Extraneous flags are cleared and not passed through to the page allocator. __GFP_MOVABLE/RECLAIMABLE, __GFP_COLD and __GFP_COMP will now be ignored if passed to a slab allocator. Change the allocation of allocator meta data in SLAB and vmalloc to not pass through flags listed in GFP_CONSTRAINT_MASK. SLAB already removes the __GFP_THISNODE flag for such allocations. Generalize that to also cover vmalloc. The use of GFP_CONSTRAINT_MASK also includes __GFP_HARDWALL. The impact of allocator metadata placement on access latency to the cachelines of the object itself is minimal since metadata is only referenced on alloc and free. The attempt is still made to place the meta data optimally but we consistently allow fallback both in SLAB and vmalloc (SLUB does not need to allocate metadata like that). Allocator metadata may serve multiple in kernel users and thus should not be subject to the limitations arising from a single allocation context. [akpm@linux-foundation.org: fix fallback_alloc()] Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/gfp.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 12a90a191c11..da8aa872eb6e 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -53,13 +53,6 @@ struct vm_area_struct;
53#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 53#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
54#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 54#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
55 55
56/* if you forget to add the bitmask here kernel will crash, period */
57#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
58 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
59 __GFP_NOFAIL|__GFP_NORETRY|__GFP_COMP| \
60 __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE| \
61 __GFP_MOVABLE)
62
63/* This equals 0, but use constants in case they ever change */ 56/* This equals 0, but use constants in case they ever change */
64#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) 57#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
65/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */ 58/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
@@ -86,6 +79,19 @@ struct vm_area_struct;
86#define GFP_THISNODE ((__force gfp_t)0) 79#define GFP_THISNODE ((__force gfp_t)0)
87#endif 80#endif
88 81
82/* This mask makes up all the page movable related flags */
83#define GFP_MOVABLE_MASK (__GFP_MOVABLE)
84
85/* Control page allocator reclaim behavior */
86#define GFP_RECLAIM_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS|\
87 __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\
88 __GFP_NORETRY|__GFP_NOMEMALLOC)
89
90/* Control allocation constraints */
91#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
92
93/* Do not use these with a slab allocator */
94#define GFP_SLAB_BUG_MASK (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK)
89 95
90/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some 96/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
91 platforms, used as appropriate on others */ 97 platforms, used as appropriate on others */