diff options
-rw-r--r-- | include/linux/gfp.h | 15 | ||||
-rw-r--r-- | mm/mempolicy.c | 2 | ||||
-rw-r--r-- | mm/page_alloc.c | 16 |
3 files changed, 16 insertions, 17 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 2a2153ebfe0b..a0992d392d79 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -85,6 +85,21 @@ static inline int gfp_zone(gfp_t gfp) | |||
85 | return zone; | 85 | return zone; |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline enum zone_type highest_zone(gfp_t flags) | ||
89 | { | ||
90 | if (flags & __GFP_DMA) | ||
91 | return ZONE_DMA; | ||
92 | #ifdef CONFIG_ZONE_DMA32 | ||
93 | if (flags & __GFP_DMA32) | ||
94 | return ZONE_DMA32; | ||
95 | #endif | ||
96 | #ifdef CONFIG_HIGHMEM | ||
97 | if (flags & __GFP_HIGHMEM) | ||
98 | return ZONE_HIGHMEM; | ||
99 | #endif | ||
100 | return ZONE_NORMAL; | ||
101 | } | ||
102 | |||
88 | /* | 103 | /* |
89 | * There is only one page-allocator function, and two main namespaces to | 104 | * There is only one page-allocator function, and two main namespaces to |
90 | * it. The alloc_page*() variants return 'struct page *' and as such | 105 | * it. The alloc_page*() variants return 'struct page *' and as such |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index a9963ceddd65..9870624d72a6 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1096,7 +1096,7 @@ static struct zonelist *zonelist_policy(gfp_t gfp, struct mempolicy *policy) | |||
1096 | case MPOL_BIND: | 1096 | case MPOL_BIND: |
1097 | /* Lower zones don't get a policy applied */ | 1097 | /* Lower zones don't get a policy applied */ |
1098 | /* Careful: current->mems_allowed might have moved */ | 1098 | /* Careful: current->mems_allowed might have moved */ |
1099 | if (gfp_zone(gfp) >= policy_zone) | 1099 | if (highest_zone(gfp) >= policy_zone) |
1100 | if (cpuset_zonelist_valid_mems_allowed(policy->v.zonelist)) | 1100 | if (cpuset_zonelist_valid_mems_allowed(policy->v.zonelist)) |
1101 | return policy->v.zonelist; | 1101 | return policy->v.zonelist; |
1102 | /*FALL THROUGH*/ | 1102 | /*FALL THROUGH*/ |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6c7c2dd1b3ed..25f39865e324 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1376,22 +1376,6 @@ static int __meminit build_zonelists_node(pg_data_t *pgdat, | |||
1376 | return nr_zones; | 1376 | return nr_zones; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | static inline int highest_zone(int zone_bits) | ||
1380 | { | ||
1381 | int res = ZONE_NORMAL; | ||
1382 | #ifdef CONFIG_HIGHMEM | ||
1383 | if (zone_bits & (__force int)__GFP_HIGHMEM) | ||
1384 | res = ZONE_HIGHMEM; | ||
1385 | #endif | ||
1386 | #ifdef CONFIG_ZONE_DMA32 | ||
1387 | if (zone_bits & (__force int)__GFP_DMA32) | ||
1388 | res = ZONE_DMA32; | ||
1389 | #endif | ||
1390 | if (zone_bits & (__force int)__GFP_DMA) | ||
1391 | res = ZONE_DMA; | ||
1392 | return res; | ||
1393 | } | ||
1394 | |||
1395 | #ifdef CONFIG_NUMA | 1379 | #ifdef CONFIG_NUMA |
1396 | #define MAX_NODE_LOAD (num_online_nodes()) | 1380 | #define MAX_NODE_LOAD (num_online_nodes()) |
1397 | static int __meminitdata node_load[MAX_NUMNODES]; | 1381 | static int __meminitdata node_load[MAX_NUMNODES]; |