diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-10-16 04:25:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:42:59 -0400 |
commit | 523b945855a1427000ffc707c610abe5947ae607 (patch) | |
tree | 2d84b5b6822a2a20bfd79146c08ce06ac8c80b9b /include/linux/gfp.h | |
parent | 633c0666b5a5c41c376a5a7e4304d638dc48c1b9 (diff) |
Memoryless nodes: Fix GFP_THISNODE behavior
GFP_THISNODE checks that the zone selected is within the pgdat (node) of the
first zone of a nodelist. That only works if the node has memory. A
memoryless node will have its first node on another pgdat (node).
GFP_THISNODE currently will return simply memory on the first pgdat. Thus it
is returning memory on other nodes. GFP_THISNODE should fail if there is no
local memory on a node.
Add a new set of zonelists for each node that only contain the nodes that
belong to the zones itself so that no fallback is possible.
Then modify gfp_type to pickup the right zone based on the presence of
__GFP_THISNODE.
Drop the existing GFP_THISNODE checks from the page_allocators hot path.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Nishanth Aravamudan <nacc@us.ibm.com>
Tested-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by: Bob Picco <bob.picco@hp.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@skynet.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/gfp.h')
-rw-r--r-- | include/linux/gfp.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index bc68dd9a6d41..12a90a191c11 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -98,22 +98,29 @@ struct vm_area_struct; | |||
98 | 98 | ||
99 | static inline enum zone_type gfp_zone(gfp_t flags) | 99 | static inline enum zone_type gfp_zone(gfp_t flags) |
100 | { | 100 | { |
101 | int base = 0; | ||
102 | |||
103 | #ifdef CONFIG_NUMA | ||
104 | if (flags & __GFP_THISNODE) | ||
105 | base = MAX_NR_ZONES; | ||
106 | #endif | ||
107 | |||
101 | #ifdef CONFIG_ZONE_DMA | 108 | #ifdef CONFIG_ZONE_DMA |
102 | if (flags & __GFP_DMA) | 109 | if (flags & __GFP_DMA) |
103 | return ZONE_DMA; | 110 | return base + ZONE_DMA; |
104 | #endif | 111 | #endif |
105 | #ifdef CONFIG_ZONE_DMA32 | 112 | #ifdef CONFIG_ZONE_DMA32 |
106 | if (flags & __GFP_DMA32) | 113 | if (flags & __GFP_DMA32) |
107 | return ZONE_DMA32; | 114 | return base + ZONE_DMA32; |
108 | #endif | 115 | #endif |
109 | if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == | 116 | if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == |
110 | (__GFP_HIGHMEM | __GFP_MOVABLE)) | 117 | (__GFP_HIGHMEM | __GFP_MOVABLE)) |
111 | return ZONE_MOVABLE; | 118 | return base + ZONE_MOVABLE; |
112 | #ifdef CONFIG_HIGHMEM | 119 | #ifdef CONFIG_HIGHMEM |
113 | if (flags & __GFP_HIGHMEM) | 120 | if (flags & __GFP_HIGHMEM) |
114 | return ZONE_HIGHMEM; | 121 | return base + ZONE_HIGHMEM; |
115 | #endif | 122 | #endif |
116 | return ZONE_NORMAL; | 123 | return base + ZONE_NORMAL; |
117 | } | 124 | } |
118 | 125 | ||
119 | /* | 126 | /* |