aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/discontig_32.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-23 06:05:30 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 06:50:20 -0400
commit2ec65f8b89ea003c27ff7723525a2ee335a2b393 (patch)
tree9b8718be2017f619b2a0185492315b85ea1731fa /arch/x86/mm/discontig_32.c
parentbef1568d9714f1162086c32583ba7984a7ca8e3e (diff)
x86: clean up using max_low_pfn on 32-bit
so that max_low_pfn is not changed after it is set. so we can move that early and out of initmem_init. could call find_low_pfn_range just after max_pfn is set. also could move reserve_initrd out of setup_bootmem_allocator so 32bit is more like 64bit. Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/discontig_32.c')
-rw-r--r--arch/x86/mm/discontig_32.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 3e75be46c4f2..1dfff700264c 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -309,11 +309,10 @@ static void init_remap_allocator(int nid)
309 (ulong) node_remap_end_vaddr[nid]); 309 (ulong) node_remap_end_vaddr[nid]);
310} 310}
311 311
312unsigned long __init initmem_init(unsigned long start_pfn, 312void __init initmem_init(unsigned long start_pfn,
313 unsigned long end_pfn) 313 unsigned long end_pfn)
314{ 314{
315 int nid; 315 int nid;
316 unsigned long system_start_pfn, system_max_low_pfn;
317 long kva_target_pfn; 316 long kva_target_pfn;
318 317
319 /* 318 /*
@@ -324,17 +323,11 @@ unsigned long __init initmem_init(unsigned long start_pfn,
324 * and ZONE_HIGHMEM. 323 * and ZONE_HIGHMEM.
325 */ 324 */
326 325
327 /* call find_max_low_pfn at first, it could update max_pfn */
328 system_max_low_pfn = max_low_pfn = find_max_low_pfn();
329
330 remove_all_active_ranges(); 326 remove_all_active_ranges();
331 get_memcfg_numa(); 327 get_memcfg_numa();
332 328
333 kva_pages = round_up(calculate_numa_remap_pages(), PTRS_PER_PTE); 329 kva_pages = round_up(calculate_numa_remap_pages(), PTRS_PER_PTE);
334 330
335 /* partially used pages are not usable - thus round upwards */
336 system_start_pfn = min_low_pfn = PFN_UP(init_pg_tables_end);
337
338 kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE); 331 kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE);
339 do { 332 do {
340 kva_start_pfn = find_e820_area(kva_target_pfn<<PAGE_SHIFT, 333 kva_start_pfn = find_e820_area(kva_target_pfn<<PAGE_SHIFT,
@@ -357,19 +350,19 @@ unsigned long __init initmem_init(unsigned long start_pfn,
357 "KVA PG"); 350 "KVA PG");
358#ifdef CONFIG_HIGHMEM 351#ifdef CONFIG_HIGHMEM
359 highstart_pfn = highend_pfn = max_pfn; 352 highstart_pfn = highend_pfn = max_pfn;
360 if (max_pfn > system_max_low_pfn) 353 if (max_pfn > max_low_pfn)
361 highstart_pfn = system_max_low_pfn; 354 highstart_pfn = max_low_pfn;
362 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 355 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
363 pages_to_mb(highend_pfn - highstart_pfn)); 356 pages_to_mb(highend_pfn - highstart_pfn));
364 num_physpages = highend_pfn; 357 num_physpages = highend_pfn;
365 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 358 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
366#else 359#else
367 num_physpages = system_max_low_pfn; 360 num_physpages = max_low_pfn;
368 high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1; 361 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
369#endif 362#endif
370 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 363 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
371 pages_to_mb(system_max_low_pfn)); 364 pages_to_mb(max_low_pfn));
372 printk("min_low_pfn = %ld, max_low_pfn = %ld, highstart_pfn = %ld\n", 365 printk("min_low_pfn = %ld, max_low_pfn = %ld, highstart_pfn = %ld\n",
373 min_low_pfn, max_low_pfn, highstart_pfn); 366 min_low_pfn, max_low_pfn, highstart_pfn);
374 367
375 printk("Low memory ends at vaddr %08lx\n", 368 printk("Low memory ends at vaddr %08lx\n",
@@ -387,7 +380,6 @@ unsigned long __init initmem_init(unsigned long start_pfn,
387 memset(NODE_DATA(0), 0, sizeof(struct pglist_data)); 380 memset(NODE_DATA(0), 0, sizeof(struct pglist_data));
388 NODE_DATA(0)->bdata = &node0_bdata; 381 NODE_DATA(0)->bdata = &node0_bdata;
389 setup_bootmem_allocator(); 382 setup_bootmem_allocator();
390 return max_low_pfn;
391} 383}
392 384
393void __init zone_sizes_init(void) 385void __init zone_sizes_init(void)