aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@saeurebad.de>2008-07-24 00:28:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:20 -0400
commit3560e249abda6bee41a07a7bf0383a6e193e2839 (patch)
treea5770b74f13dca64e34cd5a1e3182e4e1f98a9ca /mm
parent75a56cfe9fdb064d1db1cfbc564315fddb756fb1 (diff)
bootmem: replace node_boot_start in struct bootmem_data
Almost all users of this field need a PFN instead of a physical address, so replace node_boot_start with node_min_pfn. [Lee.Schermerhorn@hp.com: fix spurious BUG_ON() in mark_bootmem()] Signed-off-by: Johannes Weiner <hannes@saeureba.de> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com> 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/bootmem.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 282b786c2b15..4af15d0340ad 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -80,7 +80,7 @@ static void __init link_bootmem(bootmem_data_t *bdata)
80 bootmem_data_t *ent; 80 bootmem_data_t *ent;
81 81
82 ent = list_entry(iter, bootmem_data_t, list); 82 ent = list_entry(iter, bootmem_data_t, list);
83 if (bdata->node_boot_start < ent->node_boot_start) 83 if (bdata->node_min_pfn < ent->node_min_pfn)
84 break; 84 break;
85 } 85 }
86 list_add_tail(&bdata->list, iter); 86 list_add_tail(&bdata->list, iter);
@@ -96,7 +96,7 @@ static unsigned long __init init_bootmem_core(bootmem_data_t *bdata,
96 96
97 mminit_validate_memmodel_limits(&start, &end); 97 mminit_validate_memmodel_limits(&start, &end);
98 bdata->node_bootmem_map = phys_to_virt(PFN_PHYS(mapstart)); 98 bdata->node_bootmem_map = phys_to_virt(PFN_PHYS(mapstart));
99 bdata->node_boot_start = PFN_PHYS(start); 99 bdata->node_min_pfn = start;
100 bdata->node_low_pfn = end; 100 bdata->node_low_pfn = end;
101 link_bootmem(bdata); 101 link_bootmem(bdata);
102 102
@@ -151,7 +151,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
151 if (!bdata->node_bootmem_map) 151 if (!bdata->node_bootmem_map)
152 return 0; 152 return 0;
153 153
154 start = PFN_DOWN(bdata->node_boot_start); 154 start = bdata->node_min_pfn;
155 end = bdata->node_low_pfn; 155 end = bdata->node_low_pfn;
156 156
157 /* 157 /*
@@ -167,7 +167,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
167 unsigned long *map, idx, vec; 167 unsigned long *map, idx, vec;
168 168
169 map = bdata->node_bootmem_map; 169 map = bdata->node_bootmem_map;
170 idx = start - PFN_DOWN(bdata->node_boot_start); 170 idx = start - bdata->node_min_pfn;
171 vec = ~map[idx / BITS_PER_LONG]; 171 vec = ~map[idx / BITS_PER_LONG];
172 172
173 if (aligned && vec == ~0UL && start + BITS_PER_LONG < end) { 173 if (aligned && vec == ~0UL && start + BITS_PER_LONG < end) {
@@ -192,7 +192,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
192 } 192 }
193 193
194 page = virt_to_page(bdata->node_bootmem_map); 194 page = virt_to_page(bdata->node_bootmem_map);
195 pages = bdata->node_low_pfn - PFN_DOWN(bdata->node_boot_start); 195 pages = bdata->node_low_pfn - bdata->node_min_pfn;
196 pages = bootmem_bootmap_pages(pages); 196 pages = bootmem_bootmap_pages(pages);
197 count += pages; 197 count += pages;
198 while (pages--) 198 while (pages--)
@@ -231,8 +231,8 @@ static void __init __free(bootmem_data_t *bdata,
231 unsigned long idx; 231 unsigned long idx;
232 232
233 bdebug("nid=%td start=%lx end=%lx\n", bdata - bootmem_node_data, 233 bdebug("nid=%td start=%lx end=%lx\n", bdata - bootmem_node_data,
234 sidx + PFN_DOWN(bdata->node_boot_start), 234 sidx + bdata->node_min_pfn,
235 eidx + PFN_DOWN(bdata->node_boot_start)); 235 eidx + bdata->node_min_pfn);
236 236
237 if (bdata->hint_idx > sidx) 237 if (bdata->hint_idx > sidx)
238 bdata->hint_idx = sidx; 238 bdata->hint_idx = sidx;
@@ -250,8 +250,8 @@ static int __init __reserve(bootmem_data_t *bdata, unsigned long sidx,
250 250
251 bdebug("nid=%td start=%lx end=%lx flags=%x\n", 251 bdebug("nid=%td start=%lx end=%lx flags=%x\n",
252 bdata - bootmem_node_data, 252 bdata - bootmem_node_data,
253 sidx + PFN_DOWN(bdata->node_boot_start), 253 sidx + bdata->node_min_pfn,
254 eidx + PFN_DOWN(bdata->node_boot_start), 254 eidx + bdata->node_min_pfn,
255 flags); 255 flags);
256 256
257 for (idx = sidx; idx < eidx; idx++) 257 for (idx = sidx; idx < eidx; idx++)
@@ -261,7 +261,7 @@ static int __init __reserve(bootmem_data_t *bdata, unsigned long sidx,
261 return -EBUSY; 261 return -EBUSY;
262 } 262 }
263 bdebug("silent double reserve of PFN %lx\n", 263 bdebug("silent double reserve of PFN %lx\n",
264 idx + PFN_DOWN(bdata->node_boot_start)); 264 idx + bdata->node_min_pfn);
265 } 265 }
266 return 0; 266 return 0;
267} 267}
@@ -275,11 +275,11 @@ static int __init mark_bootmem_node(bootmem_data_t *bdata,
275 bdebug("nid=%td start=%lx end=%lx reserve=%d flags=%x\n", 275 bdebug("nid=%td start=%lx end=%lx reserve=%d flags=%x\n",
276 bdata - bootmem_node_data, start, end, reserve, flags); 276 bdata - bootmem_node_data, start, end, reserve, flags);
277 277
278 BUG_ON(start < PFN_DOWN(bdata->node_boot_start)); 278 BUG_ON(start < bdata->node_min_pfn);
279 BUG_ON(end > bdata->node_low_pfn); 279 BUG_ON(end > bdata->node_low_pfn);
280 280
281 sidx = start - PFN_DOWN(bdata->node_boot_start); 281 sidx = start - bdata->node_min_pfn;
282 eidx = end - PFN_DOWN(bdata->node_boot_start); 282 eidx = end - bdata->node_min_pfn;
283 283
284 if (reserve) 284 if (reserve)
285 return __reserve(bdata, sidx, eidx, flags); 285 return __reserve(bdata, sidx, eidx, flags);
@@ -299,7 +299,8 @@ static int __init mark_bootmem(unsigned long start, unsigned long end,
299 int err; 299 int err;
300 unsigned long max; 300 unsigned long max;
301 301
302 if (pos < PFN_DOWN(bdata->node_boot_start)) { 302 if (pos < bdata->node_min_pfn ||
303 pos >= bdata->node_low_pfn) {
303 BUG_ON(pos != start); 304 BUG_ON(pos != start);
304 continue; 305 continue;
305 } 306 }
@@ -422,7 +423,7 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
422 bdata - bootmem_node_data, size, PAGE_ALIGN(size) >> PAGE_SHIFT, 423 bdata - bootmem_node_data, size, PAGE_ALIGN(size) >> PAGE_SHIFT,
423 align, goal, limit); 424 align, goal, limit);
424 425
425 min = PFN_DOWN(bdata->node_boot_start); 426 min = bdata->node_min_pfn;
426 max = bdata->node_low_pfn; 427 max = bdata->node_low_pfn;
427 428
428 goal >>= PAGE_SHIFT; 429 goal >>= PAGE_SHIFT;
@@ -440,8 +441,8 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
440 else 441 else
441 start = ALIGN(min, step); 442 start = ALIGN(min, step);
442 443
443 sidx = start - PFN_DOWN(bdata->node_boot_start); 444 sidx = start - bdata->node_min_pfn;;
444 midx = max - PFN_DOWN(bdata->node_boot_start); 445 midx = max - bdata->node_min_pfn;
445 446
446 if (bdata->hint_idx > sidx) { 447 if (bdata->hint_idx > sidx) {
447 /* 448 /*
@@ -491,7 +492,8 @@ find_block:
491 PFN_UP(end_off), BOOTMEM_EXCLUSIVE)) 492 PFN_UP(end_off), BOOTMEM_EXCLUSIVE))
492 BUG(); 493 BUG();
493 494
494 region = phys_to_virt(bdata->node_boot_start + start_off); 495 region = phys_to_virt(PFN_PHYS(bdata->node_min_pfn) +
496 start_off);
495 memset(region, 0, size); 497 memset(region, 0, size);
496 return region; 498 return region;
497 } 499 }
@@ -518,7 +520,7 @@ restart:
518 520
519 if (goal && bdata->node_low_pfn <= PFN_DOWN(goal)) 521 if (goal && bdata->node_low_pfn <= PFN_DOWN(goal))
520 continue; 522 continue;
521 if (limit && bdata->node_boot_start >= limit) 523 if (limit && bdata->node_min_pfn >= PFN_DOWN(limit))
522 break; 524 break;
523 525
524 region = alloc_bootmem_core(bdata, size, align, goal, limit); 526 region = alloc_bootmem_core(bdata, size, align, goal, limit);