aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@engr.sgi.com>2006-01-06 03:11:17 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:28 -0500
commit4be38e351c5f455f6f490f5aff29053e33ab4f99 (patch)
treefd7ba3678cdb5750894f58034f47076dd38c64ae
parent1a93205bdffd9d7278d4a66081cdb48452522a58 (diff)
[PATCH] mm: move determination of policy_zone into page allocator
Currently the function to build a zonelist for a BIND policy has the side effect to set the policy_zone. This seems to be a bit strange. policy zone seems to not be initialized elsewhere and therefore 0. Do we police ZONE_DMA if no bind policy has been used yet? This patch moves the determination of the zone to apply policies to into the page allocator. We determine the zone while building the zonelist for nodes. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/linux/mempolicy.h11
-rw-r--r--mm/mempolicy.c15
-rw-r--r--mm/page_alloc.c2
3 files changed, 16 insertions, 12 deletions
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index b972f985a3c5..ed00b278cb93 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -151,6 +151,14 @@ extern struct mempolicy default_policy;
151extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 151extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
152 unsigned long addr); 152 unsigned long addr);
153 153
154extern int policy_zone;
155
156static inline void check_highest_zone(int k)
157{
158 if (k > policy_zone)
159 policy_zone = k;
160}
161
154#else 162#else
155 163
156struct mempolicy {}; 164struct mempolicy {};
@@ -221,6 +229,9 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
221 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER); 229 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER);
222} 230}
223 231
232static inline void check_highest_zone(int k)
233{
234}
224#endif /* CONFIG_NUMA */ 235#endif /* CONFIG_NUMA */
225#endif /* __KERNEL__ */ 236#endif /* __KERNEL__ */
226 237
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 96714e2646ad..0f1d2b8a952b 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -93,7 +93,7 @@ static kmem_cache_t *sn_cache;
93 93
94/* Highest zone. An specific allocation for a zone below that is not 94/* Highest zone. An specific allocation for a zone below that is not
95 policied. */ 95 policied. */
96static int policy_zone; 96int policy_zone = ZONE_DMA;
97 97
98struct mempolicy default_policy = { 98struct mempolicy default_policy = {
99 .refcnt = ATOMIC_INIT(1), /* never free it */ 99 .refcnt = ATOMIC_INIT(1), /* never free it */
@@ -131,17 +131,8 @@ static struct zonelist *bind_zonelist(nodemask_t *nodes)
131 if (!zl) 131 if (!zl)
132 return NULL; 132 return NULL;
133 num = 0; 133 num = 0;
134 for_each_node_mask(nd, *nodes) { 134 for_each_node_mask(nd, *nodes)
135 int k; 135 zl->zones[num++] = &NODE_DATA(nd)->node_zones[policy_zone];
136 for (k = MAX_NR_ZONES-1; k >= 0; k--) {
137 struct zone *z = &NODE_DATA(nd)->node_zones[k];
138 if (!z->present_pages)
139 continue;
140 zl->zones[num++] = z;
141 if (k > policy_zone)
142 policy_zone = k;
143 }
144 }
145 zl->zones[num] = NULL; 136 zl->zones[num] = NULL;
146 return zl; 137 return zl;
147} 138}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7adc9526d329..512e3f4d4963 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -36,6 +36,7 @@
36#include <linux/memory_hotplug.h> 36#include <linux/memory_hotplug.h>
37#include <linux/nodemask.h> 37#include <linux/nodemask.h>
38#include <linux/vmalloc.h> 38#include <linux/vmalloc.h>
39#include <linux/mempolicy.h>
39 40
40#include <asm/tlbflush.h> 41#include <asm/tlbflush.h>
41#include "internal.h" 42#include "internal.h"
@@ -1470,6 +1471,7 @@ static int __init build_zonelists_node(pg_data_t *pgdat,
1470 BUG_ON(zone - pgdat->node_zones > ZONE_NORMAL); 1471 BUG_ON(zone - pgdat->node_zones > ZONE_NORMAL);
1471#endif 1472#endif
1472 zonelist->zones[j++] = zone; 1473 zonelist->zones[j++] = zone;
1474 check_highest_zone(k);
1473 } 1475 }
1474 } 1476 }
1475 return j; 1477 return j;