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 /mm | |
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 'mm')
-rw-r--r-- | mm/page_alloc.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d06f6e0f75aa..2f547f45de18 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1191,9 +1191,6 @@ zonelist_scan: | |||
1191 | !zlc_zone_worth_trying(zonelist, z, allowednodes)) | 1191 | !zlc_zone_worth_trying(zonelist, z, allowednodes)) |
1192 | continue; | 1192 | continue; |
1193 | zone = *z; | 1193 | zone = *z; |
1194 | if (unlikely(NUMA_BUILD && (gfp_mask & __GFP_THISNODE) && | ||
1195 | zone->zone_pgdat != zonelist->zones[0]->zone_pgdat)) | ||
1196 | break; | ||
1197 | if ((alloc_flags & ALLOC_CPUSET) && | 1194 | if ((alloc_flags & ALLOC_CPUSET) && |
1198 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) | 1195 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) |
1199 | goto try_next_zone; | 1196 | goto try_next_zone; |
@@ -1262,7 +1259,10 @@ restart: | |||
1262 | z = zonelist->zones; /* the list of zones suitable for gfp_mask */ | 1259 | z = zonelist->zones; /* the list of zones suitable for gfp_mask */ |
1263 | 1260 | ||
1264 | if (unlikely(*z == NULL)) { | 1261 | if (unlikely(*z == NULL)) { |
1265 | /* Should this ever happen?? */ | 1262 | /* |
1263 | * Happens if we have an empty zonelist as a result of | ||
1264 | * GFP_THISNODE being used on a memoryless node | ||
1265 | */ | ||
1266 | return NULL; | 1266 | return NULL; |
1267 | } | 1267 | } |
1268 | 1268 | ||
@@ -1858,6 +1858,22 @@ static void build_zonelists_in_node_order(pg_data_t *pgdat, int node) | |||
1858 | } | 1858 | } |
1859 | 1859 | ||
1860 | /* | 1860 | /* |
1861 | * Build gfp_thisnode zonelists | ||
1862 | */ | ||
1863 | static void build_thisnode_zonelists(pg_data_t *pgdat) | ||
1864 | { | ||
1865 | enum zone_type i; | ||
1866 | int j; | ||
1867 | struct zonelist *zonelist; | ||
1868 | |||
1869 | for (i = 0; i < MAX_NR_ZONES; i++) { | ||
1870 | zonelist = pgdat->node_zonelists + MAX_NR_ZONES + i; | ||
1871 | j = build_zonelists_node(pgdat, zonelist, 0, i); | ||
1872 | zonelist->zones[j] = NULL; | ||
1873 | } | ||
1874 | } | ||
1875 | |||
1876 | /* | ||
1861 | * Build zonelists ordered by zone and nodes within zones. | 1877 | * Build zonelists ordered by zone and nodes within zones. |
1862 | * This results in conserving DMA zone[s] until all Normal memory is | 1878 | * This results in conserving DMA zone[s] until all Normal memory is |
1863 | * exhausted, but results in overflowing to remote node while memory | 1879 | * exhausted, but results in overflowing to remote node while memory |
@@ -1961,7 +1977,7 @@ static void build_zonelists(pg_data_t *pgdat) | |||
1961 | int order = current_zonelist_order; | 1977 | int order = current_zonelist_order; |
1962 | 1978 | ||
1963 | /* initialize zonelists */ | 1979 | /* initialize zonelists */ |
1964 | for (i = 0; i < MAX_NR_ZONES; i++) { | 1980 | for (i = 0; i < MAX_ZONELISTS; i++) { |
1965 | zonelist = pgdat->node_zonelists + i; | 1981 | zonelist = pgdat->node_zonelists + i; |
1966 | zonelist->zones[0] = NULL; | 1982 | zonelist->zones[0] = NULL; |
1967 | } | 1983 | } |
@@ -2006,6 +2022,8 @@ static void build_zonelists(pg_data_t *pgdat) | |||
2006 | /* calculate node order -- i.e., DMA last! */ | 2022 | /* calculate node order -- i.e., DMA last! */ |
2007 | build_zonelists_in_zone_order(pgdat, j); | 2023 | build_zonelists_in_zone_order(pgdat, j); |
2008 | } | 2024 | } |
2025 | |||
2026 | build_thisnode_zonelists(pgdat); | ||
2009 | } | 2027 | } |
2010 | 2028 | ||
2011 | /* Construct the zonelist performance cache - see further mmzone.h */ | 2029 | /* Construct the zonelist performance cache - see further mmzone.h */ |