diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 20:12:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 20:12:13 -0400 |
commit | 7f0ef0267e20d62d45d527911a993b1e998f4968 (patch) | |
tree | de51abc7da5903f59d83e23937f22420164c9477 /arch | |
parent | 862f0012549110d6f2586bf54b52ed4540cbff3a (diff) | |
parent | 9307c29524502c21f0e8a6d96d850b2f5bc0bd9a (diff) |
Merge branch 'akpm' (updates from Andrew Morton)
Merge first patch-bomb from Andrew Morton:
- various misc bits
- I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been
distracted. There has been quite a bit of activity.
- About half the MM queue
- Some backlight bits
- Various lib/ updates
- checkpatch updates
- zillions more little rtc patches
- ptrace
- signals
- exec
- procfs
- rapidio
- nbd
- aoe
- pps
- memstick
- tools/testing/selftests updates
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (445 commits)
tools/testing/selftests: don't assume the x bit is set on scripts
selftests: add .gitignore for kcmp
selftests: fix clean target in kcmp Makefile
selftests: add .gitignore for vm
selftests: add hugetlbfstest
self-test: fix make clean
selftests: exit 1 on failure
kernel/resource.c: remove the unneeded assignment in function __find_resource
aio: fix wrong comment in aio_complete()
drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode
drivers/memstick/host/r592.c: convert to module_pci_driver
drivers/memstick/host/jmb38x_ms: convert to module_pci_driver
pps-gpio: add device-tree binding and support
drivers/pps/clients/pps-gpio.c: convert to module_platform_driver
drivers/pps/clients/pps-gpio.c: convert to devm_* helpers
drivers/parport/share.c: use kzalloc
Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
aoe: update internal version number to v83
aoe: update copyright date
aoe: perform I/O completions in parallel
...
Diffstat (limited to 'arch')
80 files changed, 331 insertions, 1323 deletions
diff --git a/arch/Kconfig b/arch/Kconfig index a4429bcd609e..8d2ae24b9f4a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -365,6 +365,9 @@ config HAVE_IRQ_TIME_ACCOUNTING | |||
365 | config HAVE_ARCH_TRANSPARENT_HUGEPAGE | 365 | config HAVE_ARCH_TRANSPARENT_HUGEPAGE |
366 | bool | 366 | bool |
367 | 367 | ||
368 | config HAVE_ARCH_SOFT_DIRTY | ||
369 | bool | ||
370 | |||
368 | config HAVE_MOD_ARCH_SPECIFIC | 371 | config HAVE_MOD_ARCH_SPECIFIC |
369 | bool | 372 | bool |
370 | help | 373 | help |
diff --git a/arch/alpha/include/asm/mmzone.h b/arch/alpha/include/asm/mmzone.h index c5b5d6bac9ed..14ce27bccd24 100644 --- a/arch/alpha/include/asm/mmzone.h +++ b/arch/alpha/include/asm/mmzone.h | |||
@@ -71,8 +71,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
71 | 71 | ||
72 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 72 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
73 | 73 | ||
74 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) | ||
75 | |||
76 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) | 74 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) |
77 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32)) | 75 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32)) |
78 | #define pte_pfn(pte) (pte_val(pte) >> 32) | 76 | #define pte_pfn(pte) (pte_val(pte) >> 32) |
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 1d4aabfcf9a1..837c0fa58317 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c | |||
@@ -238,8 +238,8 @@ nautilus_init_pci(void) | |||
238 | if (pci_mem < memtop) | 238 | if (pci_mem < memtop) |
239 | memtop = pci_mem; | 239 | memtop = pci_mem; |
240 | if (memtop > alpha_mv.min_mem_address) { | 240 | if (memtop > alpha_mv.min_mem_address) { |
241 | free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address), | 241 | free_reserved_area(__va(alpha_mv.min_mem_address), |
242 | (unsigned long)__va(memtop), 0, NULL); | 242 | __va(memtop), -1, NULL); |
243 | printk("nautilus_init_pci: %ldk freed\n", | 243 | printk("nautilus_init_pci: %ldk freed\n", |
244 | (memtop - alpha_mv.min_mem_address) >> 10); | 244 | (memtop - alpha_mv.min_mem_address) >> 10); |
245 | } | 245 | } |
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c index 0ba85ee4a466..a1bea91df56a 100644 --- a/arch/alpha/mm/init.c +++ b/arch/alpha/mm/init.c | |||
@@ -276,56 +276,25 @@ srm_paging_stop (void) | |||
276 | } | 276 | } |
277 | #endif | 277 | #endif |
278 | 278 | ||
279 | #ifndef CONFIG_DISCONTIGMEM | ||
280 | static void __init | ||
281 | printk_memory_info(void) | ||
282 | { | ||
283 | unsigned long codesize, reservedpages, datasize, initsize, tmp; | ||
284 | extern int page_is_ram(unsigned long) __init; | ||
285 | |||
286 | /* printk all informations */ | ||
287 | reservedpages = 0; | ||
288 | for (tmp = 0; tmp < max_low_pfn; tmp++) | ||
289 | /* | ||
290 | * Only count reserved RAM pages | ||
291 | */ | ||
292 | if (page_is_ram(tmp) && PageReserved(mem_map+tmp)) | ||
293 | reservedpages++; | ||
294 | |||
295 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
296 | datasize = (unsigned long) &_edata - (unsigned long) &_data; | ||
297 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
298 | |||
299 | printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, %luk data, %luk init)\n", | ||
300 | nr_free_pages() << (PAGE_SHIFT-10), | ||
301 | max_mapnr << (PAGE_SHIFT-10), | ||
302 | codesize >> 10, | ||
303 | reservedpages << (PAGE_SHIFT-10), | ||
304 | datasize >> 10, | ||
305 | initsize >> 10); | ||
306 | } | ||
307 | |||
308 | void __init | 279 | void __init |
309 | mem_init(void) | 280 | mem_init(void) |
310 | { | 281 | { |
311 | max_mapnr = num_physpages = max_low_pfn; | 282 | set_max_mapnr(max_low_pfn); |
312 | totalram_pages += free_all_bootmem(); | ||
313 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); | 283 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); |
314 | 284 | free_all_bootmem(); | |
315 | printk_memory_info(); | 285 | mem_init_print_info(NULL); |
316 | } | 286 | } |
317 | #endif /* CONFIG_DISCONTIGMEM */ | ||
318 | 287 | ||
319 | void | 288 | void |
320 | free_initmem(void) | 289 | free_initmem(void) |
321 | { | 290 | { |
322 | free_initmem_default(0); | 291 | free_initmem_default(-1); |
323 | } | 292 | } |
324 | 293 | ||
325 | #ifdef CONFIG_BLK_DEV_INITRD | 294 | #ifdef CONFIG_BLK_DEV_INITRD |
326 | void | 295 | void |
327 | free_initrd_mem(unsigned long start, unsigned long end) | 296 | free_initrd_mem(unsigned long start, unsigned long end) |
328 | { | 297 | { |
329 | free_reserved_area(start, end, 0, "initrd"); | 298 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
330 | } | 299 | } |
331 | #endif | 300 | #endif |
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c index 33885048fa36..d543d71c28b4 100644 --- a/arch/alpha/mm/numa.c +++ b/arch/alpha/mm/numa.c | |||
@@ -129,8 +129,6 @@ setup_memory_node(int nid, void *kernel_end) | |||
129 | if (node_max_pfn > max_low_pfn) | 129 | if (node_max_pfn > max_low_pfn) |
130 | max_pfn = max_low_pfn = node_max_pfn; | 130 | max_pfn = max_low_pfn = node_max_pfn; |
131 | 131 | ||
132 | num_physpages += node_max_pfn - node_min_pfn; | ||
133 | |||
134 | #if 0 /* we'll try this one again in a little while */ | 132 | #if 0 /* we'll try this one again in a little while */ |
135 | /* Cute trick to make sure our local node data is on local memory */ | 133 | /* Cute trick to make sure our local node data is on local memory */ |
136 | node_data[nid] = (pg_data_t *)(__va(node_min_pfn << PAGE_SHIFT)); | 134 | node_data[nid] = (pg_data_t *)(__va(node_min_pfn << PAGE_SHIFT)); |
@@ -321,41 +319,3 @@ void __init paging_init(void) | |||
321 | /* Initialize the kernel's ZERO_PGE. */ | 319 | /* Initialize the kernel's ZERO_PGE. */ |
322 | memset((void *)ZERO_PGE, 0, PAGE_SIZE); | 320 | memset((void *)ZERO_PGE, 0, PAGE_SIZE); |
323 | } | 321 | } |
324 | |||
325 | void __init mem_init(void) | ||
326 | { | ||
327 | unsigned long codesize, reservedpages, datasize, initsize, pfn; | ||
328 | extern int page_is_ram(unsigned long) __init; | ||
329 | unsigned long nid, i; | ||
330 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); | ||
331 | |||
332 | reservedpages = 0; | ||
333 | for_each_online_node(nid) { | ||
334 | /* | ||
335 | * This will free up the bootmem, ie, slot 0 memory | ||
336 | */ | ||
337 | totalram_pages += free_all_bootmem_node(NODE_DATA(nid)); | ||
338 | |||
339 | pfn = NODE_DATA(nid)->node_start_pfn; | ||
340 | for (i = 0; i < node_spanned_pages(nid); i++, pfn++) | ||
341 | if (page_is_ram(pfn) && | ||
342 | PageReserved(nid_page_nr(nid, i))) | ||
343 | reservedpages++; | ||
344 | } | ||
345 | |||
346 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
347 | datasize = (unsigned long) &_edata - (unsigned long) &_data; | ||
348 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
349 | |||
350 | printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, " | ||
351 | "%luk data, %luk init)\n", | ||
352 | nr_free_pages() << (PAGE_SHIFT-10), | ||
353 | num_physpages << (PAGE_SHIFT-10), | ||
354 | codesize >> 10, | ||
355 | reservedpages << (PAGE_SHIFT-10), | ||
356 | datasize >> 10, | ||
357 | initsize >> 10); | ||
358 | #if 0 | ||
359 | mem_stress(); | ||
360 | #endif | ||
361 | } | ||
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index 4a177365b2c4..a08ce7185423 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c | |||
@@ -74,7 +74,7 @@ void __init setup_arch_memory(void) | |||
74 | /* Last usable page of low mem (no HIGHMEM yet for ARC port) */ | 74 | /* Last usable page of low mem (no HIGHMEM yet for ARC port) */ |
75 | max_low_pfn = max_pfn = PFN_DOWN(end_mem); | 75 | max_low_pfn = max_pfn = PFN_DOWN(end_mem); |
76 | 76 | ||
77 | max_mapnr = num_physpages = max_low_pfn - min_low_pfn; | 77 | max_mapnr = max_low_pfn - min_low_pfn; |
78 | 78 | ||
79 | /*------------- reserve kernel image -----------------------*/ | 79 | /*------------- reserve kernel image -----------------------*/ |
80 | memblock_reserve(CONFIG_LINUX_LINK_BASE, | 80 | memblock_reserve(CONFIG_LINUX_LINK_BASE, |
@@ -84,7 +84,7 @@ void __init setup_arch_memory(void) | |||
84 | 84 | ||
85 | /*-------------- node setup --------------------------------*/ | 85 | /*-------------- node setup --------------------------------*/ |
86 | memset(zones_size, 0, sizeof(zones_size)); | 86 | memset(zones_size, 0, sizeof(zones_size)); |
87 | zones_size[ZONE_NORMAL] = num_physpages; | 87 | zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * We can't use the helper free_area_init(zones[]) because it uses | 90 | * We can't use the helper free_area_init(zones[]) because it uses |
@@ -106,39 +106,9 @@ void __init setup_arch_memory(void) | |||
106 | */ | 106 | */ |
107 | void __init mem_init(void) | 107 | void __init mem_init(void) |
108 | { | 108 | { |
109 | int codesize, datasize, initsize, reserved_pages, free_pages; | ||
110 | int tmp; | ||
111 | |||
112 | high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz); | 109 | high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz); |
113 | 110 | free_all_bootmem(); | |
114 | totalram_pages = free_all_bootmem(); | 111 | mem_init_print_info(NULL); |
115 | |||
116 | /* count all reserved pages [kernel code/data/mem_map..] */ | ||
117 | reserved_pages = 0; | ||
118 | for (tmp = 0; tmp < max_mapnr; tmp++) | ||
119 | if (PageReserved(mem_map + tmp)) | ||
120 | reserved_pages++; | ||
121 | |||
122 | /* XXX: nr_free_pages() is equivalent */ | ||
123 | free_pages = max_mapnr - reserved_pages; | ||
124 | |||
125 | /* | ||
126 | * For the purpose of display below, split the "reserve mem" | ||
127 | * kernel code/data is already shown explicitly, | ||
128 | * Show any other reservations (mem_map[ ] et al) | ||
129 | */ | ||
130 | reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >> | ||
131 | PAGE_SHIFT); | ||
132 | |||
133 | codesize = _etext - _text; | ||
134 | datasize = _end - _etext; | ||
135 | initsize = __init_end - __init_begin; | ||
136 | |||
137 | pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n", | ||
138 | PAGES_TO_MB(free_pages), | ||
139 | TO_MB(arc_mem_sz), | ||
140 | TO_KB(codesize), TO_KB(datasize), TO_KB(initsize), | ||
141 | PAGES_TO_KB(reserved_pages)); | ||
142 | } | 112 | } |
143 | 113 | ||
144 | /* | 114 | /* |
@@ -146,13 +116,13 @@ void __init mem_init(void) | |||
146 | */ | 116 | */ |
147 | void __init_refok free_initmem(void) | 117 | void __init_refok free_initmem(void) |
148 | { | 118 | { |
149 | free_initmem_default(0); | 119 | free_initmem_default(-1); |
150 | } | 120 | } |
151 | 121 | ||
152 | #ifdef CONFIG_BLK_DEV_INITRD | 122 | #ifdef CONFIG_BLK_DEV_INITRD |
153 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 123 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
154 | { | 124 | { |
155 | free_reserved_area(start, end, 0, "initrd"); | 125 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
156 | } | 126 | } |
157 | #endif | 127 | #endif |
158 | 128 | ||
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi index 7d1a27949c13..9866cd736dee 100644 --- a/arch/arm/boot/dts/atlas6.dtsi +++ b/arch/arm/boot/dts/atlas6.dtsi | |||
@@ -613,7 +613,7 @@ | |||
613 | }; | 613 | }; |
614 | 614 | ||
615 | rtc-iobg { | 615 | rtc-iobg { |
616 | compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus"; | 616 | compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus", "simple-bus"; |
617 | #address-cells = <1>; | 617 | #address-cells = <1>; |
618 | #size-cells = <1>; | 618 | #size-cells = <1>; |
619 | reg = <0x80030000 0x10000>; | 619 | reg = <0x80030000 0x10000>; |
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi index 02edd8965f8a..05e9489cf95c 100644 --- a/arch/arm/boot/dts/prima2.dtsi +++ b/arch/arm/boot/dts/prima2.dtsi | |||
@@ -610,7 +610,7 @@ | |||
610 | }; | 610 | }; |
611 | 611 | ||
612 | rtc-iobg { | 612 | rtc-iobg { |
613 | compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus"; | 613 | compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus", "simple-bus"; |
614 | #address-cells = <1>; | 614 | #address-cells = <1>; |
615 | #size-cells = <1>; | 615 | #size-cells = <1>; |
616 | reg = <0x80030000 0x10000>; | 616 | reg = <0x80030000 0x10000>; |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 584786f740f9..e750a938fd3c 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -276,12 +276,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x) | |||
276 | /* | 276 | /* |
277 | * Conversion between a struct page and a physical address. | 277 | * Conversion between a struct page and a physical address. |
278 | * | 278 | * |
279 | * Note: when converting an unknown physical address to a | ||
280 | * struct page, the resulting pointer must be validated | ||
281 | * using VALID_PAGE(). It must return an invalid struct page | ||
282 | * for any physical address not corresponding to a system | ||
283 | * RAM address. | ||
284 | * | ||
285 | * page_to_pfn(page) convert a struct page * to a PFN number | 279 | * page_to_pfn(page) convert a struct page * to a PFN number |
286 | * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * | 280 | * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * |
287 | * | 281 | * |
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c index 3181f61ea63e..1c5bd7637b05 100644 --- a/arch/arm/mach-iop13xx/setup.c +++ b/arch/arm/mach-iop13xx/setup.c | |||
@@ -469,7 +469,6 @@ void __init iop13xx_platform_init(void) | |||
469 | dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); | 469 | dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); |
470 | dma_cap_set(DMA_XOR, plat_data->cap_mask); | 470 | dma_cap_set(DMA_XOR, plat_data->cap_mask); |
471 | dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); | 471 | dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); |
472 | dma_cap_set(DMA_MEMSET, plat_data->cap_mask); | ||
473 | dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); | 472 | dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); |
474 | break; | 473 | break; |
475 | case IOP13XX_INIT_ADMA_1: | 474 | case IOP13XX_INIT_ADMA_1: |
@@ -479,7 +478,6 @@ void __init iop13xx_platform_init(void) | |||
479 | dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); | 478 | dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); |
480 | dma_cap_set(DMA_XOR, plat_data->cap_mask); | 479 | dma_cap_set(DMA_XOR, plat_data->cap_mask); |
481 | dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); | 480 | dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); |
482 | dma_cap_set(DMA_MEMSET, plat_data->cap_mask); | ||
483 | dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); | 481 | dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); |
484 | break; | 482 | break; |
485 | case IOP13XX_INIT_ADMA_2: | 483 | case IOP13XX_INIT_ADMA_2: |
@@ -489,7 +487,6 @@ void __init iop13xx_platform_init(void) | |||
489 | dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); | 487 | dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); |
490 | dma_cap_set(DMA_XOR, plat_data->cap_mask); | 488 | dma_cap_set(DMA_XOR, plat_data->cap_mask); |
491 | dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); | 489 | dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); |
492 | dma_cap_set(DMA_MEMSET, plat_data->cap_mask); | ||
493 | dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); | 490 | dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); |
494 | dma_cap_set(DMA_PQ, plat_data->cap_mask); | 491 | dma_cap_set(DMA_PQ, plat_data->cap_mask); |
495 | dma_cap_set(DMA_PQ_VAL, plat_data->cap_mask); | 492 | dma_cap_set(DMA_PQ_VAL, plat_data->cap_mask); |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 2ffee02d1d5c..6833cbead6cc 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -583,9 +583,6 @@ static void __init free_highpages(void) | |||
583 | */ | 583 | */ |
584 | void __init mem_init(void) | 584 | void __init mem_init(void) |
585 | { | 585 | { |
586 | unsigned long reserved_pages, free_pages; | ||
587 | struct memblock_region *reg; | ||
588 | int i; | ||
589 | #ifdef CONFIG_HAVE_TCM | 586 | #ifdef CONFIG_HAVE_TCM |
590 | /* These pointers are filled in on TCM detection */ | 587 | /* These pointers are filled in on TCM detection */ |
591 | extern u32 dtcm_end; | 588 | extern u32 dtcm_end; |
@@ -596,57 +593,16 @@ void __init mem_init(void) | |||
596 | 593 | ||
597 | /* this will put all unused low memory onto the freelists */ | 594 | /* this will put all unused low memory onto the freelists */ |
598 | free_unused_memmap(&meminfo); | 595 | free_unused_memmap(&meminfo); |
599 | 596 | free_all_bootmem(); | |
600 | totalram_pages += free_all_bootmem(); | ||
601 | 597 | ||
602 | #ifdef CONFIG_SA1111 | 598 | #ifdef CONFIG_SA1111 |
603 | /* now that our DMA memory is actually so designated, we can free it */ | 599 | /* now that our DMA memory is actually so designated, we can free it */ |
604 | free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL); | 600 | free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, -1, NULL); |
605 | #endif | 601 | #endif |
606 | 602 | ||
607 | free_highpages(); | 603 | free_highpages(); |
608 | 604 | ||
609 | reserved_pages = free_pages = 0; | 605 | mem_init_print_info(NULL); |
610 | |||
611 | for_each_bank(i, &meminfo) { | ||
612 | struct membank *bank = &meminfo.bank[i]; | ||
613 | unsigned int pfn1, pfn2; | ||
614 | struct page *page, *end; | ||
615 | |||
616 | pfn1 = bank_pfn_start(bank); | ||
617 | pfn2 = bank_pfn_end(bank); | ||
618 | |||
619 | page = pfn_to_page(pfn1); | ||
620 | end = pfn_to_page(pfn2 - 1) + 1; | ||
621 | |||
622 | do { | ||
623 | if (PageReserved(page)) | ||
624 | reserved_pages++; | ||
625 | else if (!page_count(page)) | ||
626 | free_pages++; | ||
627 | page++; | ||
628 | } while (page < end); | ||
629 | } | ||
630 | |||
631 | /* | ||
632 | * Since our memory may not be contiguous, calculate the | ||
633 | * real number of pages we have in this system | ||
634 | */ | ||
635 | printk(KERN_INFO "Memory:"); | ||
636 | num_physpages = 0; | ||
637 | for_each_memblock(memory, reg) { | ||
638 | unsigned long pages = memblock_region_memory_end_pfn(reg) - | ||
639 | memblock_region_memory_base_pfn(reg); | ||
640 | num_physpages += pages; | ||
641 | printk(" %ldMB", pages >> (20 - PAGE_SHIFT)); | ||
642 | } | ||
643 | printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); | ||
644 | |||
645 | printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n", | ||
646 | nr_free_pages() << (PAGE_SHIFT-10), | ||
647 | free_pages << (PAGE_SHIFT-10), | ||
648 | reserved_pages << (PAGE_SHIFT-10), | ||
649 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
650 | 606 | ||
651 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 | 607 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 |
652 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 | 608 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 |
@@ -712,7 +668,7 @@ void __init mem_init(void) | |||
712 | BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); | 668 | BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); |
713 | #endif | 669 | #endif |
714 | 670 | ||
715 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | 671 | if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) { |
716 | extern int sysctl_overcommit_memory; | 672 | extern int sysctl_overcommit_memory; |
717 | /* | 673 | /* |
718 | * On a machine this small we won't get | 674 | * On a machine this small we won't get |
@@ -729,12 +685,12 @@ void free_initmem(void) | |||
729 | extern char __tcm_start, __tcm_end; | 685 | extern char __tcm_start, __tcm_end; |
730 | 686 | ||
731 | poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); | 687 | poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); |
732 | free_reserved_area(&__tcm_start, &__tcm_end, 0, "TCM link"); | 688 | free_reserved_area(&__tcm_start, &__tcm_end, -1, "TCM link"); |
733 | #endif | 689 | #endif |
734 | 690 | ||
735 | poison_init_mem(__init_begin, __init_end - __init_begin); | 691 | poison_init_mem(__init_begin, __init_end - __init_begin); |
736 | if (!machine_is_integrator() && !machine_is_cintegrator()) | 692 | if (!machine_is_integrator() && !machine_is_cintegrator()) |
737 | free_initmem_default(0); | 693 | free_initmem_default(-1); |
738 | } | 694 | } |
739 | 695 | ||
740 | #ifdef CONFIG_BLK_DEV_INITRD | 696 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -745,7 +701,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
745 | { | 701 | { |
746 | if (!keep_initrd) { | 702 | if (!keep_initrd) { |
747 | poison_init_mem((void *)start, PAGE_ALIGN(end) - start); | 703 | poison_init_mem((void *)start, PAGE_ALIGN(end) - start); |
748 | free_reserved_area(start, end, 0, "initrd"); | 704 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
749 | } | 705 | } |
750 | } | 706 | } |
751 | 707 | ||
diff --git a/arch/arm/plat-iop/adma.c b/arch/arm/plat-iop/adma.c index 1ff6a37e893c..a4d1f8de3b5b 100644 --- a/arch/arm/plat-iop/adma.c +++ b/arch/arm/plat-iop/adma.c | |||
@@ -192,12 +192,10 @@ static int __init iop3xx_adma_cap_init(void) | |||
192 | 192 | ||
193 | #ifdef CONFIG_ARCH_IOP32X /* the 32x AAU does not perform zero sum */ | 193 | #ifdef CONFIG_ARCH_IOP32X /* the 32x AAU does not perform zero sum */ |
194 | dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask); | 194 | dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask); |
195 | dma_cap_set(DMA_MEMSET, iop3xx_aau_data.cap_mask); | ||
196 | dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask); | 195 | dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask); |
197 | #else | 196 | #else |
198 | dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask); | 197 | dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask); |
199 | dma_cap_set(DMA_XOR_VAL, iop3xx_aau_data.cap_mask); | 198 | dma_cap_set(DMA_XOR_VAL, iop3xx_aau_data.cap_mask); |
200 | dma_cap_set(DMA_MEMSET, iop3xx_aau_data.cap_mask); | ||
201 | dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask); | 199 | dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask); |
202 | #endif | 200 | #endif |
203 | 201 | ||
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index c019b7aaf776..c66d163d7a2a 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -666,14 +666,9 @@ void __init orion_xor0_init(unsigned long mapbase_low, | |||
666 | orion_xor0_shared_resources[3].start = irq_1; | 666 | orion_xor0_shared_resources[3].start = irq_1; |
667 | orion_xor0_shared_resources[3].end = irq_1; | 667 | orion_xor0_shared_resources[3].end = irq_1; |
668 | 668 | ||
669 | /* | ||
670 | * two engines can't do memset simultaneously, this limitation | ||
671 | * satisfied by removing memset support from one of the engines. | ||
672 | */ | ||
673 | dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[0].cap_mask); | 669 | dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[0].cap_mask); |
674 | dma_cap_set(DMA_XOR, orion_xor0_channels_data[0].cap_mask); | 670 | dma_cap_set(DMA_XOR, orion_xor0_channels_data[0].cap_mask); |
675 | 671 | ||
676 | dma_cap_set(DMA_MEMSET, orion_xor0_channels_data[1].cap_mask); | ||
677 | dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[1].cap_mask); | 672 | dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[1].cap_mask); |
678 | dma_cap_set(DMA_XOR, orion_xor0_channels_data[1].cap_mask); | 673 | dma_cap_set(DMA_XOR, orion_xor0_channels_data[1].cap_mask); |
679 | 674 | ||
@@ -732,14 +727,9 @@ void __init orion_xor1_init(unsigned long mapbase_low, | |||
732 | orion_xor1_shared_resources[3].start = irq_1; | 727 | orion_xor1_shared_resources[3].start = irq_1; |
733 | orion_xor1_shared_resources[3].end = irq_1; | 728 | orion_xor1_shared_resources[3].end = irq_1; |
734 | 729 | ||
735 | /* | ||
736 | * two engines can't do memset simultaneously, this limitation | ||
737 | * satisfied by removing memset support from one of the engines. | ||
738 | */ | ||
739 | dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[0].cap_mask); | 730 | dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[0].cap_mask); |
740 | dma_cap_set(DMA_XOR, orion_xor1_channels_data[0].cap_mask); | 731 | dma_cap_set(DMA_XOR, orion_xor1_channels_data[0].cap_mask); |
741 | 732 | ||
742 | dma_cap_set(DMA_MEMSET, orion_xor1_channels_data[1].cap_mask); | ||
743 | dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[1].cap_mask); | 733 | dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[1].cap_mask); |
744 | dma_cap_set(DMA_XOR, orion_xor1_channels_data[1].cap_mask); | 734 | dma_cap_set(DMA_XOR, orion_xor1_channels_data[1].cap_mask); |
745 | 735 | ||
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index f497ca77925a..67e8d7ce3fe7 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -197,14 +197,6 @@ void __init bootmem_init(void) | |||
197 | max_pfn = max_low_pfn = max; | 197 | max_pfn = max_low_pfn = max; |
198 | } | 198 | } |
199 | 199 | ||
200 | /* | ||
201 | * Poison init memory with an undefined instruction (0x0). | ||
202 | */ | ||
203 | static inline void poison_init_mem(void *s, size_t count) | ||
204 | { | ||
205 | memset(s, 0, count); | ||
206 | } | ||
207 | |||
208 | #ifndef CONFIG_SPARSEMEM_VMEMMAP | 200 | #ifndef CONFIG_SPARSEMEM_VMEMMAP |
209 | static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn) | 201 | static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn) |
210 | { | 202 | { |
@@ -280,59 +272,17 @@ static void __init free_unused_memmap(void) | |||
280 | */ | 272 | */ |
281 | void __init mem_init(void) | 273 | void __init mem_init(void) |
282 | { | 274 | { |
283 | unsigned long reserved_pages, free_pages; | ||
284 | struct memblock_region *reg; | ||
285 | |||
286 | arm64_swiotlb_init(); | 275 | arm64_swiotlb_init(); |
287 | 276 | ||
288 | max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; | 277 | max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; |
289 | 278 | ||
290 | #ifndef CONFIG_SPARSEMEM_VMEMMAP | 279 | #ifndef CONFIG_SPARSEMEM_VMEMMAP |
291 | /* this will put all unused low memory onto the freelists */ | ||
292 | free_unused_memmap(); | 280 | free_unused_memmap(); |
293 | #endif | 281 | #endif |
282 | /* this will put all unused low memory onto the freelists */ | ||
283 | free_all_bootmem(); | ||
294 | 284 | ||
295 | totalram_pages += free_all_bootmem(); | 285 | mem_init_print_info(NULL); |
296 | |||
297 | reserved_pages = free_pages = 0; | ||
298 | |||
299 | for_each_memblock(memory, reg) { | ||
300 | unsigned int pfn1, pfn2; | ||
301 | struct page *page, *end; | ||
302 | |||
303 | pfn1 = __phys_to_pfn(reg->base); | ||
304 | pfn2 = pfn1 + __phys_to_pfn(reg->size); | ||
305 | |||
306 | page = pfn_to_page(pfn1); | ||
307 | end = pfn_to_page(pfn2 - 1) + 1; | ||
308 | |||
309 | do { | ||
310 | if (PageReserved(page)) | ||
311 | reserved_pages++; | ||
312 | else if (!page_count(page)) | ||
313 | free_pages++; | ||
314 | page++; | ||
315 | } while (page < end); | ||
316 | } | ||
317 | |||
318 | /* | ||
319 | * Since our memory may not be contiguous, calculate the real number | ||
320 | * of pages we have in this system. | ||
321 | */ | ||
322 | pr_info("Memory:"); | ||
323 | num_physpages = 0; | ||
324 | for_each_memblock(memory, reg) { | ||
325 | unsigned long pages = memblock_region_memory_end_pfn(reg) - | ||
326 | memblock_region_memory_base_pfn(reg); | ||
327 | num_physpages += pages; | ||
328 | printk(" %ldMB", pages >> (20 - PAGE_SHIFT)); | ||
329 | } | ||
330 | printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); | ||
331 | |||
332 | pr_notice("Memory: %luk/%luk available, %luk reserved\n", | ||
333 | nr_free_pages() << (PAGE_SHIFT-10), | ||
334 | free_pages << (PAGE_SHIFT-10), | ||
335 | reserved_pages << (PAGE_SHIFT-10)); | ||
336 | 286 | ||
337 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 | 287 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 |
338 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 | 288 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 |
@@ -374,7 +324,7 @@ void __init mem_init(void) | |||
374 | BUILD_BUG_ON(TASK_SIZE_64 > MODULES_VADDR); | 324 | BUILD_BUG_ON(TASK_SIZE_64 > MODULES_VADDR); |
375 | BUG_ON(TASK_SIZE_64 > MODULES_VADDR); | 325 | BUG_ON(TASK_SIZE_64 > MODULES_VADDR); |
376 | 326 | ||
377 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | 327 | if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) { |
378 | extern int sysctl_overcommit_memory; | 328 | extern int sysctl_overcommit_memory; |
379 | /* | 329 | /* |
380 | * On a machine this small we won't get anywhere without | 330 | * On a machine this small we won't get anywhere without |
@@ -386,7 +336,6 @@ void __init mem_init(void) | |||
386 | 336 | ||
387 | void free_initmem(void) | 337 | void free_initmem(void) |
388 | { | 338 | { |
389 | poison_init_mem(__init_begin, __init_end - __init_begin); | ||
390 | free_initmem_default(0); | 339 | free_initmem_default(0); |
391 | } | 340 | } |
392 | 341 | ||
@@ -396,10 +345,8 @@ static int keep_initrd; | |||
396 | 345 | ||
397 | void free_initrd_mem(unsigned long start, unsigned long end) | 346 | void free_initrd_mem(unsigned long start, unsigned long end) |
398 | { | 347 | { |
399 | if (!keep_initrd) { | 348 | if (!keep_initrd) |
400 | poison_init_mem((void *)start, PAGE_ALIGN(end) - start); | 349 | free_reserved_area((void *)start, (void *)end, 0, "initrd"); |
401 | free_reserved_area(start, end, 0, "initrd"); | ||
402 | } | ||
403 | } | 350 | } |
404 | 351 | ||
405 | static int __init keepinitrd_setup(char *__unused) | 352 | static int __init keepinitrd_setup(char *__unused) |
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c index b4247f478065..209ae5ad3495 100644 --- a/arch/avr32/kernel/setup.c +++ b/arch/avr32/kernel/setup.c | |||
@@ -555,7 +555,7 @@ void __init setup_arch (char **cmdline_p) | |||
555 | { | 555 | { |
556 | struct clk *cpu_clk; | 556 | struct clk *cpu_clk; |
557 | 557 | ||
558 | init_mm.start_code = (unsigned long)_text; | 558 | init_mm.start_code = (unsigned long)_stext; |
559 | init_mm.end_code = (unsigned long)_etext; | 559 | init_mm.end_code = (unsigned long)_etext; |
560 | init_mm.end_data = (unsigned long)_edata; | 560 | init_mm.end_data = (unsigned long)_edata; |
561 | init_mm.brk = (unsigned long)_end; | 561 | init_mm.brk = (unsigned long)_end; |
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S index 9cd2bd91d64a..a4589176bed5 100644 --- a/arch/avr32/kernel/vmlinux.lds.S +++ b/arch/avr32/kernel/vmlinux.lds.S | |||
@@ -23,7 +23,7 @@ SECTIONS | |||
23 | { | 23 | { |
24 | . = CONFIG_ENTRY_ADDRESS; | 24 | . = CONFIG_ENTRY_ADDRESS; |
25 | .init : AT(ADDR(.init) - LOAD_OFFSET) { | 25 | .init : AT(ADDR(.init) - LOAD_OFFSET) { |
26 | _stext = .; | 26 | _text = .; |
27 | __init_begin = .; | 27 | __init_begin = .; |
28 | _sinittext = .; | 28 | _sinittext = .; |
29 | *(.text.reset) | 29 | *(.text.reset) |
@@ -46,7 +46,7 @@ SECTIONS | |||
46 | 46 | ||
47 | .text : AT(ADDR(.text) - LOAD_OFFSET) { | 47 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
48 | _evba = .; | 48 | _evba = .; |
49 | _text = .; | 49 | _stext = .; |
50 | *(.ex.text) | 50 | *(.ex.text) |
51 | *(.irq.text) | 51 | *(.irq.text) |
52 | KPROBES_TEXT | 52 | KPROBES_TEXT |
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c index e66e8406f992..def5391d927a 100644 --- a/arch/avr32/mm/init.c +++ b/arch/avr32/mm/init.c | |||
@@ -100,60 +100,26 @@ void __init paging_init(void) | |||
100 | 100 | ||
101 | void __init mem_init(void) | 101 | void __init mem_init(void) |
102 | { | 102 | { |
103 | int codesize, reservedpages, datasize, initsize; | 103 | pg_data_t *pgdat; |
104 | int nid, i; | ||
105 | 104 | ||
106 | reservedpages = 0; | ||
107 | high_memory = NULL; | 105 | high_memory = NULL; |
106 | for_each_online_pgdat(pgdat) | ||
107 | high_memory = max_t(void *, high_memory, | ||
108 | __va(pgdat_end_pfn(pgdat) << PAGE_SHIFT)); | ||
108 | 109 | ||
109 | /* this will put all low memory onto the freelists */ | 110 | set_max_mapnr(MAP_NR(high_memory)); |
110 | for_each_online_node(nid) { | 111 | free_all_bootmem(); |
111 | pg_data_t *pgdat = NODE_DATA(nid); | 112 | mem_init_print_info(NULL); |
112 | unsigned long node_pages = 0; | ||
113 | void *node_high_memory; | ||
114 | |||
115 | num_physpages += pgdat->node_present_pages; | ||
116 | |||
117 | if (pgdat->node_spanned_pages != 0) | ||
118 | node_pages = free_all_bootmem_node(pgdat); | ||
119 | |||
120 | totalram_pages += node_pages; | ||
121 | |||
122 | for (i = 0; i < node_pages; i++) | ||
123 | if (PageReserved(pgdat->node_mem_map + i)) | ||
124 | reservedpages++; | ||
125 | |||
126 | node_high_memory = (void *)((pgdat->node_start_pfn | ||
127 | + pgdat->node_spanned_pages) | ||
128 | << PAGE_SHIFT); | ||
129 | if (node_high_memory > high_memory) | ||
130 | high_memory = node_high_memory; | ||
131 | } | ||
132 | |||
133 | max_mapnr = MAP_NR(high_memory); | ||
134 | |||
135 | codesize = (unsigned long)_etext - (unsigned long)_text; | ||
136 | datasize = (unsigned long)_edata - (unsigned long)_data; | ||
137 | initsize = (unsigned long)__init_end - (unsigned long)__init_begin; | ||
138 | |||
139 | printk ("Memory: %luk/%luk available (%dk kernel code, " | ||
140 | "%dk reserved, %dk data, %dk init)\n", | ||
141 | nr_free_pages() << (PAGE_SHIFT - 10), | ||
142 | totalram_pages << (PAGE_SHIFT - 10), | ||
143 | codesize >> 10, | ||
144 | reservedpages << (PAGE_SHIFT - 10), | ||
145 | datasize >> 10, | ||
146 | initsize >> 10); | ||
147 | } | 113 | } |
148 | 114 | ||
149 | void free_initmem(void) | 115 | void free_initmem(void) |
150 | { | 116 | { |
151 | free_initmem_default(0); | 117 | free_initmem_default(-1); |
152 | } | 118 | } |
153 | 119 | ||
154 | #ifdef CONFIG_BLK_DEV_INITRD | 120 | #ifdef CONFIG_BLK_DEV_INITRD |
155 | void free_initrd_mem(unsigned long start, unsigned long end) | 121 | void free_initrd_mem(unsigned long start, unsigned long end) |
156 | { | 122 | { |
157 | free_reserved_area(start, end, 0, "initrd"); | 123 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
158 | } | 124 | } |
159 | #endif | 125 | #endif |
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c index 82d01a71207f..166842de3dc7 100644 --- a/arch/blackfin/mm/init.c +++ b/arch/blackfin/mm/init.c | |||
@@ -90,50 +90,24 @@ asmlinkage void __init init_pda(void) | |||
90 | 90 | ||
91 | void __init mem_init(void) | 91 | void __init mem_init(void) |
92 | { | 92 | { |
93 | unsigned int codek = 0, datak = 0, initk = 0; | 93 | char buf[64]; |
94 | unsigned int reservedpages = 0, freepages = 0; | ||
95 | unsigned long tmp; | ||
96 | unsigned long start_mem = memory_start; | ||
97 | unsigned long end_mem = memory_end; | ||
98 | 94 | ||
99 | end_mem &= PAGE_MASK; | 95 | high_memory = (void *)(memory_end & PAGE_MASK); |
100 | high_memory = (void *)end_mem; | 96 | max_mapnr = MAP_NR(high_memory); |
101 | 97 | printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", max_mapnr); | |
102 | start_mem = PAGE_ALIGN(start_mem); | ||
103 | max_mapnr = num_physpages = MAP_NR(high_memory); | ||
104 | printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages); | ||
105 | 98 | ||
106 | /* This will put all low memory onto the freelists. */ | 99 | /* This will put all low memory onto the freelists. */ |
107 | totalram_pages = free_all_bootmem(); | 100 | free_all_bootmem(); |
108 | |||
109 | reservedpages = 0; | ||
110 | for (tmp = ARCH_PFN_OFFSET; tmp < max_mapnr; tmp++) | ||
111 | if (PageReserved(pfn_to_page(tmp))) | ||
112 | reservedpages++; | ||
113 | freepages = max_mapnr - ARCH_PFN_OFFSET - reservedpages; | ||
114 | |||
115 | /* do not count in kernel image between _rambase and _ramstart */ | ||
116 | reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT; | ||
117 | #if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) && ANOMALY_05000263) | ||
118 | reservedpages += (_ramend - memory_end - DMA_UNCACHED_REGION) >> PAGE_SHIFT; | ||
119 | #endif | ||
120 | |||
121 | codek = (_etext - _stext) >> 10; | ||
122 | initk = (__init_end - __init_begin) >> 10; | ||
123 | datak = ((_ramstart - _rambase) >> 10) - codek - initk; | ||
124 | 101 | ||
125 | printk(KERN_INFO | 102 | snprintf(buf, sizeof(buf) - 1, "%uK DMA", DMA_UNCACHED_REGION >> 10); |
126 | "Memory available: %luk/%luk RAM, " | 103 | mem_init_print_info(buf); |
127 | "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n", | ||
128 | (unsigned long) freepages << (PAGE_SHIFT-10), (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 10, | ||
129 | initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10))); | ||
130 | } | 104 | } |
131 | 105 | ||
132 | #ifdef CONFIG_BLK_DEV_INITRD | 106 | #ifdef CONFIG_BLK_DEV_INITRD |
133 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 107 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
134 | { | 108 | { |
135 | #ifndef CONFIG_MPU | 109 | #ifndef CONFIG_MPU |
136 | free_reserved_area(start, end, 0, "initrd"); | 110 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
137 | #endif | 111 | #endif |
138 | } | 112 | } |
139 | #endif | 113 | #endif |
@@ -141,7 +115,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end) | |||
141 | void __init_refok free_initmem(void) | 115 | void __init_refok free_initmem(void) |
142 | { | 116 | { |
143 | #if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU | 117 | #if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU |
144 | free_initmem_default(0); | 118 | free_initmem_default(-1); |
145 | if (memory_start == (unsigned long)(&__init_end)) | 119 | if (memory_start == (unsigned long)(&__init_end)) |
146 | memory_start = (unsigned long)(&__init_begin); | 120 | memory_start = (unsigned long)(&__init_begin); |
147 | #endif | 121 | #endif |
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S index 1d81c4c129ec..279d80725128 100644 --- a/arch/c6x/kernel/vmlinux.lds.S +++ b/arch/c6x/kernel/vmlinux.lds.S | |||
@@ -54,16 +54,15 @@ SECTIONS | |||
54 | } | 54 | } |
55 | 55 | ||
56 | . = ALIGN(PAGE_SIZE); | 56 | . = ALIGN(PAGE_SIZE); |
57 | __init_begin = .; | ||
57 | .init : | 58 | .init : |
58 | { | 59 | { |
59 | _stext = .; | ||
60 | _sinittext = .; | 60 | _sinittext = .; |
61 | HEAD_TEXT | 61 | HEAD_TEXT |
62 | INIT_TEXT | 62 | INIT_TEXT |
63 | _einittext = .; | 63 | _einittext = .; |
64 | } | 64 | } |
65 | 65 | ||
66 | __init_begin = _stext; | ||
67 | INIT_DATA_SECTION(16) | 66 | INIT_DATA_SECTION(16) |
68 | 67 | ||
69 | PERCPU_SECTION(128) | 68 | PERCPU_SECTION(128) |
@@ -74,6 +73,7 @@ SECTIONS | |||
74 | .text : | 73 | .text : |
75 | { | 74 | { |
76 | _text = .; | 75 | _text = .; |
76 | _stext = .; | ||
77 | TEXT_TEXT | 77 | TEXT_TEXT |
78 | SCHED_TEXT | 78 | SCHED_TEXT |
79 | LOCK_TEXT | 79 | LOCK_TEXT |
diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c index a9fcd89b251b..63f5560d6eb2 100644 --- a/arch/c6x/mm/init.c +++ b/arch/c6x/mm/init.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/initrd.h> | 18 | #include <linux/initrd.h> |
19 | 19 | ||
20 | #include <asm/sections.h> | 20 | #include <asm/sections.h> |
21 | #include <asm/uaccess.h> | ||
21 | 22 | ||
22 | /* | 23 | /* |
23 | * ZERO_PAGE is a special page that is used for zero-initialized | 24 | * ZERO_PAGE is a special page that is used for zero-initialized |
@@ -57,31 +58,22 @@ void __init paging_init(void) | |||
57 | 58 | ||
58 | void __init mem_init(void) | 59 | void __init mem_init(void) |
59 | { | 60 | { |
60 | int codek, datak; | ||
61 | unsigned long tmp; | ||
62 | unsigned long len = memory_end - memory_start; | ||
63 | |||
64 | high_memory = (void *)(memory_end & PAGE_MASK); | 61 | high_memory = (void *)(memory_end & PAGE_MASK); |
65 | 62 | ||
66 | /* this will put all memory onto the freelists */ | 63 | /* this will put all memory onto the freelists */ |
67 | totalram_pages = free_all_bootmem(); | 64 | free_all_bootmem(); |
68 | |||
69 | codek = (_etext - _stext) >> 10; | ||
70 | datak = (_end - _sdata) >> 10; | ||
71 | 65 | ||
72 | tmp = nr_free_pages() << PAGE_SHIFT; | 66 | mem_init_print_info(NULL); |
73 | printk(KERN_INFO "Memory: %luk/%luk RAM (%dk kernel code, %dk data)\n", | ||
74 | tmp >> 10, len >> 10, codek, datak); | ||
75 | } | 67 | } |
76 | 68 | ||
77 | #ifdef CONFIG_BLK_DEV_INITRD | 69 | #ifdef CONFIG_BLK_DEV_INITRD |
78 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 70 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
79 | { | 71 | { |
80 | free_reserved_area(start, end, 0, "initrd"); | 72 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
81 | } | 73 | } |
82 | #endif | 74 | #endif |
83 | 75 | ||
84 | void __init free_initmem(void) | 76 | void __init free_initmem(void) |
85 | { | 77 | { |
86 | free_initmem_default(0); | 78 | free_initmem_default(-1); |
87 | } | 79 | } |
diff --git a/arch/cris/include/asm/page.h b/arch/cris/include/asm/page.h index be45ee366be9..dfc53f9b88ec 100644 --- a/arch/cris/include/asm/page.h +++ b/arch/cris/include/asm/page.h | |||
@@ -51,7 +51,6 @@ typedef struct page *pgtable_t; | |||
51 | */ | 51 | */ |
52 | 52 | ||
53 | #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT)) | 53 | #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT)) |
54 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) | ||
55 | #define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT) | 54 | #define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT) |
56 | 55 | ||
57 | /* convert a page (based on mem_map and forward) to a physical address | 56 | /* convert a page (based on mem_map and forward) to a physical address |
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c index 9ac80946dada..c81af5bd9167 100644 --- a/arch/cris/mm/init.c +++ b/arch/cris/mm/init.c | |||
@@ -19,9 +19,6 @@ unsigned long empty_zero_page; | |||
19 | void __init | 19 | void __init |
20 | mem_init(void) | 20 | mem_init(void) |
21 | { | 21 | { |
22 | int codesize, reservedpages, datasize, initsize; | ||
23 | unsigned long tmp; | ||
24 | |||
25 | BUG_ON(!mem_map); | 22 | BUG_ON(!mem_map); |
26 | 23 | ||
27 | /* max/min_low_pfn was set by setup.c | 24 | /* max/min_low_pfn was set by setup.c |
@@ -29,35 +26,9 @@ mem_init(void) | |||
29 | * | 26 | * |
30 | * high_memory was also set in setup.c | 27 | * high_memory was also set in setup.c |
31 | */ | 28 | */ |
32 | 29 | max_mapnr = max_low_pfn - min_low_pfn; | |
33 | max_mapnr = num_physpages = max_low_pfn - min_low_pfn; | 30 | free_all_bootmem(); |
34 | 31 | mem_init_print_info(NULL); | |
35 | /* this will put all memory onto the freelists */ | ||
36 | totalram_pages = free_all_bootmem(); | ||
37 | |||
38 | reservedpages = 0; | ||
39 | for (tmp = 0; tmp < max_mapnr; tmp++) { | ||
40 | /* | ||
41 | * Only count reserved RAM pages | ||
42 | */ | ||
43 | if (PageReserved(mem_map + tmp)) | ||
44 | reservedpages++; | ||
45 | } | ||
46 | |||
47 | codesize = (unsigned long) &_etext - (unsigned long) &_stext; | ||
48 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
49 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
50 | |||
51 | printk(KERN_INFO | ||
52 | "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, " | ||
53 | "%dk init)\n" , | ||
54 | nr_free_pages() << (PAGE_SHIFT-10), | ||
55 | max_mapnr << (PAGE_SHIFT-10), | ||
56 | codesize >> 10, | ||
57 | reservedpages << (PAGE_SHIFT-10), | ||
58 | datasize >> 10, | ||
59 | initsize >> 10 | ||
60 | ); | ||
61 | } | 32 | } |
62 | 33 | ||
63 | /* free the pages occupied by initialization code */ | 34 | /* free the pages occupied by initialization code */ |
@@ -65,5 +36,5 @@ mem_init(void) | |||
65 | void | 36 | void |
66 | free_initmem(void) | 37 | free_initmem(void) |
67 | { | 38 | { |
68 | free_initmem_default(0); | 39 | free_initmem_default(-1); |
69 | } | 40 | } |
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c index a5136474c6fd..ae3a6706419b 100644 --- a/arch/frv/kernel/setup.c +++ b/arch/frv/kernel/setup.c | |||
@@ -735,7 +735,7 @@ static void __init parse_cmdline_early(char *cmdline) | |||
735 | /* "mem=XXX[kKmM]" sets SDRAM size to <mem>, overriding the value we worked | 735 | /* "mem=XXX[kKmM]" sets SDRAM size to <mem>, overriding the value we worked |
736 | * out from the SDRAM controller mask register | 736 | * out from the SDRAM controller mask register |
737 | */ | 737 | */ |
738 | if (!memcmp(cmdline, "mem=", 4)) { | 738 | if (!strncmp(cmdline, "mem=", 4)) { |
739 | unsigned long long mem_size; | 739 | unsigned long long mem_size; |
740 | 740 | ||
741 | mem_size = memparse(cmdline + 4, &cmdline); | 741 | mem_size = memparse(cmdline + 4, &cmdline); |
@@ -876,6 +876,7 @@ late_initcall(setup_arch_serial); | |||
876 | static void __init setup_linux_memory(void) | 876 | static void __init setup_linux_memory(void) |
877 | { | 877 | { |
878 | unsigned long bootmap_size, low_top_pfn, kstart, kend, high_mem; | 878 | unsigned long bootmap_size, low_top_pfn, kstart, kend, high_mem; |
879 | unsigned long physpages; | ||
879 | 880 | ||
880 | kstart = (unsigned long) &__kernel_image_start - PAGE_OFFSET; | 881 | kstart = (unsigned long) &__kernel_image_start - PAGE_OFFSET; |
881 | kend = (unsigned long) &__kernel_image_end - PAGE_OFFSET; | 882 | kend = (unsigned long) &__kernel_image_end - PAGE_OFFSET; |
@@ -893,19 +894,19 @@ static void __init setup_linux_memory(void) | |||
893 | ); | 894 | ); |
894 | 895 | ||
895 | /* pass the memory that the kernel can immediately use over to the bootmem allocator */ | 896 | /* pass the memory that the kernel can immediately use over to the bootmem allocator */ |
896 | max_mapnr = num_physpages = (memory_end - memory_start) >> PAGE_SHIFT; | 897 | max_mapnr = physpages = (memory_end - memory_start) >> PAGE_SHIFT; |
897 | low_top_pfn = (KERNEL_LOWMEM_END - KERNEL_LOWMEM_START) >> PAGE_SHIFT; | 898 | low_top_pfn = (KERNEL_LOWMEM_END - KERNEL_LOWMEM_START) >> PAGE_SHIFT; |
898 | high_mem = 0; | 899 | high_mem = 0; |
899 | 900 | ||
900 | if (num_physpages > low_top_pfn) { | 901 | if (physpages > low_top_pfn) { |
901 | #ifdef CONFIG_HIGHMEM | 902 | #ifdef CONFIG_HIGHMEM |
902 | high_mem = num_physpages - low_top_pfn; | 903 | high_mem = physpages - low_top_pfn; |
903 | #else | 904 | #else |
904 | max_mapnr = num_physpages = low_top_pfn; | 905 | max_mapnr = physpages = low_top_pfn; |
905 | #endif | 906 | #endif |
906 | } | 907 | } |
907 | else { | 908 | else { |
908 | low_top_pfn = num_physpages; | 909 | low_top_pfn = physpages; |
909 | } | 910 | } |
910 | 911 | ||
911 | min_low_pfn = memory_start >> PAGE_SHIFT; | 912 | min_low_pfn = memory_start >> PAGE_SHIFT; |
@@ -979,7 +980,7 @@ static void __init setup_uclinux_memory(void) | |||
979 | free_bootmem(memory_start, memory_end - memory_start); | 980 | free_bootmem(memory_start, memory_end - memory_start); |
980 | 981 | ||
981 | high_memory = (void *) (memory_end & PAGE_MASK); | 982 | high_memory = (void *) (memory_end & PAGE_MASK); |
982 | max_mapnr = num_physpages = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT; | 983 | max_mapnr = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT; |
983 | 984 | ||
984 | min_low_pfn = memory_start >> PAGE_SHIFT; | 985 | min_low_pfn = memory_start >> PAGE_SHIFT; |
985 | max_low_pfn = memory_end >> PAGE_SHIFT; | 986 | max_low_pfn = memory_end >> PAGE_SHIFT; |
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c index 4bff48c19d29..a6d105d61b26 100644 --- a/arch/frv/kernel/traps.c +++ b/arch/frv/kernel/traps.c | |||
@@ -523,7 +523,7 @@ void die_if_kernel(const char *str, ...) | |||
523 | return; | 523 | return; |
524 | 524 | ||
525 | va_start(va, str); | 525 | va_start(va, str); |
526 | vsprintf(buffer, str, va); | 526 | vsnprintf(buffer, sizeof(buffer), str, va); |
527 | va_end(va); | 527 | va_end(va); |
528 | 528 | ||
529 | console_verbose(); | 529 | console_verbose(); |
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c index dee354fa6b64..88a159743528 100644 --- a/arch/frv/mm/init.c +++ b/arch/frv/mm/init.c | |||
@@ -78,7 +78,7 @@ void __init paging_init(void) | |||
78 | memset((void *) empty_zero_page, 0, PAGE_SIZE); | 78 | memset((void *) empty_zero_page, 0, PAGE_SIZE); |
79 | 79 | ||
80 | #ifdef CONFIG_HIGHMEM | 80 | #ifdef CONFIG_HIGHMEM |
81 | if (num_physpages - num_mappedpages) { | 81 | if (get_num_physpages() - num_mappedpages) { |
82 | pgd_t *pge; | 82 | pgd_t *pge; |
83 | pud_t *pue; | 83 | pud_t *pue; |
84 | pmd_t *pme; | 84 | pmd_t *pme; |
@@ -96,7 +96,7 @@ void __init paging_init(void) | |||
96 | */ | 96 | */ |
97 | zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; | 97 | zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; |
98 | #ifdef CONFIG_HIGHMEM | 98 | #ifdef CONFIG_HIGHMEM |
99 | zones_size[ZONE_HIGHMEM] = num_physpages - num_mappedpages; | 99 | zones_size[ZONE_HIGHMEM] = get_num_physpages() - num_mappedpages; |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | free_area_init(zones_size); | 102 | free_area_init(zones_size); |
@@ -114,45 +114,24 @@ void __init paging_init(void) | |||
114 | */ | 114 | */ |
115 | void __init mem_init(void) | 115 | void __init mem_init(void) |
116 | { | 116 | { |
117 | unsigned long npages = (memory_end - memory_start) >> PAGE_SHIFT; | 117 | unsigned long code_size = _etext - _stext; |
118 | unsigned long tmp; | ||
119 | #ifdef CONFIG_MMU | ||
120 | unsigned long loop, pfn; | ||
121 | int datapages = 0; | ||
122 | #endif | ||
123 | int codek = 0, datak = 0; | ||
124 | 118 | ||
125 | /* this will put all low memory onto the freelists */ | 119 | /* this will put all low memory onto the freelists */ |
126 | totalram_pages = free_all_bootmem(); | 120 | free_all_bootmem(); |
127 | 121 | #if defined(CONFIG_MMU) && defined(CONFIG_HIGHMEM) | |
128 | #ifdef CONFIG_MMU | 122 | { |
129 | for (loop = 0 ; loop < npages ; loop++) | 123 | unsigned long pfn; |
130 | if (PageReserved(&mem_map[loop])) | 124 | |
131 | datapages++; | 125 | for (pfn = get_num_physpages() - 1; |
132 | 126 | pfn >= num_mappedpages; pfn--) | |
133 | #ifdef CONFIG_HIGHMEM | 127 | free_highmem_page(&mem_map[pfn]); |
134 | for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--) | 128 | } |
135 | free_highmem_page(&mem_map[pfn]); | ||
136 | #endif | ||
137 | |||
138 | codek = ((unsigned long) &_etext - (unsigned long) &_stext) >> 10; | ||
139 | datak = datapages << (PAGE_SHIFT - 10); | ||
140 | |||
141 | #else | ||
142 | codek = (_etext - _stext) >> 10; | ||
143 | datak = 0; //(__bss_stop - _sdata) >> 10; | ||
144 | #endif | 129 | #endif |
145 | 130 | ||
146 | tmp = nr_free_pages() << PAGE_SHIFT; | 131 | mem_init_print_info(NULL); |
147 | printk("Memory available: %luKiB/%luKiB RAM, %luKiB/%luKiB ROM (%dKiB kernel code, %dKiB data)\n", | 132 | if (rom_length > 0 && rom_length >= code_size) |
148 | tmp >> 10, | 133 | printk("Memory available: %luKiB/%luKiB ROM\n", |
149 | npages << (PAGE_SHIFT - 10), | 134 | (rom_length - code_size) >> 10, rom_length >> 10); |
150 | (rom_length > 0) ? ((rom_length >> 10) - codek) : 0, | ||
151 | rom_length >> 10, | ||
152 | codek, | ||
153 | datak | ||
154 | ); | ||
155 | |||
156 | } /* end mem_init() */ | 135 | } /* end mem_init() */ |
157 | 136 | ||
158 | /*****************************************************************************/ | 137 | /*****************************************************************************/ |
@@ -162,7 +141,7 @@ void __init mem_init(void) | |||
162 | void free_initmem(void) | 141 | void free_initmem(void) |
163 | { | 142 | { |
164 | #if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) | 143 | #if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) |
165 | free_initmem_default(0); | 144 | free_initmem_default(-1); |
166 | #endif | 145 | #endif |
167 | } /* end free_initmem() */ | 146 | } /* end free_initmem() */ |
168 | 147 | ||
@@ -173,6 +152,6 @@ void free_initmem(void) | |||
173 | #ifdef CONFIG_BLK_DEV_INITRD | 152 | #ifdef CONFIG_BLK_DEV_INITRD |
174 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 153 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
175 | { | 154 | { |
176 | free_reserved_area(start, end, 0, "initrd"); | 155 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
177 | } /* end free_initrd_mem() */ | 156 | } /* end free_initrd_mem() */ |
178 | #endif | 157 | #endif |
diff --git a/arch/h8300/boot/compressed/misc.c b/arch/h8300/boot/compressed/misc.c index 51ab6cbd030f..4a1e3dd43948 100644 --- a/arch/h8300/boot/compressed/misc.c +++ b/arch/h8300/boot/compressed/misc.c | |||
@@ -79,7 +79,6 @@ static void error(char *m); | |||
79 | 79 | ||
80 | int puts(const char *); | 80 | int puts(const char *); |
81 | 81 | ||
82 | extern int _text; /* Defined in vmlinux.lds.S */ | ||
83 | extern int _end; | 82 | extern int _end; |
84 | static unsigned long free_mem_ptr; | 83 | static unsigned long free_mem_ptr; |
85 | static unsigned long free_mem_end_ptr; | 84 | static unsigned long free_mem_end_ptr; |
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S index 03d356d96e5d..3253fed42ac1 100644 --- a/arch/h8300/kernel/vmlinux.lds.S +++ b/arch/h8300/kernel/vmlinux.lds.S | |||
@@ -132,10 +132,12 @@ SECTIONS | |||
132 | { | 132 | { |
133 | . = ALIGN(0x4) ; | 133 | . = ALIGN(0x4) ; |
134 | __sbss = . ; | 134 | __sbss = . ; |
135 | ___bss_start = . ; | ||
135 | *(.bss*) | 136 | *(.bss*) |
136 | . = ALIGN(0x4) ; | 137 | . = ALIGN(0x4) ; |
137 | *(COMMON) | 138 | *(COMMON) |
138 | . = ALIGN(0x4) ; | 139 | . = ALIGN(0x4) ; |
140 | ___bss_stop = . ; | ||
139 | __ebss = . ; | 141 | __ebss = . ; |
140 | __end = . ; | 142 | __end = . ; |
141 | __ramstart = .; | 143 | __ramstart = .; |
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c index ff349d70a29b..6c1251e491af 100644 --- a/arch/h8300/mm/init.c +++ b/arch/h8300/mm/init.c | |||
@@ -121,47 +121,27 @@ void __init paging_init(void) | |||
121 | 121 | ||
122 | void __init mem_init(void) | 122 | void __init mem_init(void) |
123 | { | 123 | { |
124 | int codek = 0, datak = 0, initk = 0; | 124 | unsigned long codesize = _etext - _stext; |
125 | /* DAVIDM look at setup memory map generically with reserved area */ | ||
126 | unsigned long tmp; | ||
127 | extern unsigned long _ramend, _ramstart; | ||
128 | unsigned long len = &_ramend - &_ramstart; | ||
129 | unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */ | ||
130 | unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */ | ||
131 | 125 | ||
132 | #ifdef DEBUG | 126 | pr_devel("Mem_init: start=%lx, end=%lx\n", memory_start, memory_end); |
133 | printk(KERN_DEBUG "Mem_init: start=%lx, end=%lx\n", start_mem, end_mem); | ||
134 | #endif | ||
135 | 127 | ||
136 | end_mem &= PAGE_MASK; | 128 | high_memory = (void *) (memory_end & PAGE_MASK); |
137 | high_memory = (void *) end_mem; | 129 | max_mapnr = MAP_NR(high_memory); |
138 | |||
139 | start_mem = PAGE_ALIGN(start_mem); | ||
140 | max_mapnr = num_physpages = MAP_NR(high_memory); | ||
141 | 130 | ||
142 | /* this will put all low memory onto the freelists */ | 131 | /* this will put all low memory onto the freelists */ |
143 | totalram_pages = free_all_bootmem(); | 132 | free_all_bootmem(); |
144 | 133 | ||
145 | codek = (_etext - _stext) >> 10; | 134 | mem_init_print_info(NULL); |
146 | datak = (__bss_stop - _sdata) >> 10; | 135 | if (rom_length > 0 && rom_length > codesize) |
147 | initk = (__init_begin - __init_end) >> 10; | 136 | pr_info("Memory available: %luK/%luK ROM\n", |
148 | 137 | (rom_length - codesize) >> 10, rom_length >> 10); | |
149 | tmp = nr_free_pages() << PAGE_SHIFT; | ||
150 | printk(KERN_INFO "Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n", | ||
151 | tmp >> 10, | ||
152 | len >> 10, | ||
153 | (rom_length > 0) ? ((rom_length >> 10) - codek) : 0, | ||
154 | rom_length >> 10, | ||
155 | codek, | ||
156 | datak | ||
157 | ); | ||
158 | } | 138 | } |
159 | 139 | ||
160 | 140 | ||
161 | #ifdef CONFIG_BLK_DEV_INITRD | 141 | #ifdef CONFIG_BLK_DEV_INITRD |
162 | void free_initrd_mem(unsigned long start, unsigned long end) | 142 | void free_initrd_mem(unsigned long start, unsigned long end) |
163 | { | 143 | { |
164 | free_reserved_area(start, end, 0, "initrd"); | 144 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
165 | } | 145 | } |
166 | #endif | 146 | #endif |
167 | 147 | ||
@@ -169,7 +149,7 @@ void | |||
169 | free_initmem(void) | 149 | free_initmem(void) |
170 | { | 150 | { |
171 | #ifdef CONFIG_RAMKERNEL | 151 | #ifdef CONFIG_RAMKERNEL |
172 | free_initmem_default(0); | 152 | free_initmem_default(-1); |
173 | #endif | 153 | #endif |
174 | } | 154 | } |
175 | 155 | ||
diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c index 2561d259a296..88977e42af0a 100644 --- a/arch/hexagon/mm/init.c +++ b/arch/hexagon/mm/init.c | |||
@@ -70,10 +70,8 @@ unsigned long long kmap_generation; | |||
70 | void __init mem_init(void) | 70 | void __init mem_init(void) |
71 | { | 71 | { |
72 | /* No idea where this is actually declared. Seems to evade LXR. */ | 72 | /* No idea where this is actually declared. Seems to evade LXR. */ |
73 | totalram_pages += free_all_bootmem(); | 73 | free_all_bootmem(); |
74 | num_physpages = bootmem_lastpg-ARCH_PFN_OFFSET; | 74 | mem_init_print_info(NULL); |
75 | |||
76 | printk(KERN_INFO "totalram_pages = %ld\n", totalram_pages); | ||
77 | 75 | ||
78 | /* | 76 | /* |
79 | * To-Do: someone somewhere should wipe out the bootmem map | 77 | * To-Do: someone somewhere should wipe out the bootmem map |
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index f034563aeae5..51bce594eb83 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c | |||
@@ -1116,11 +1116,6 @@ efi_memmap_init(u64 *s, u64 *e) | |||
1116 | if (!is_memory_available(md)) | 1116 | if (!is_memory_available(md)) |
1117 | continue; | 1117 | continue; |
1118 | 1118 | ||
1119 | #ifdef CONFIG_CRASH_DUMP | ||
1120 | /* saved_max_pfn should ignore max_addr= command line arg */ | ||
1121 | if (saved_max_pfn < (efi_md_end(md) >> PAGE_SHIFT)) | ||
1122 | saved_max_pfn = (efi_md_end(md) >> PAGE_SHIFT); | ||
1123 | #endif | ||
1124 | /* | 1119 | /* |
1125 | * Round ends inward to granule boundaries | 1120 | * Round ends inward to granule boundaries |
1126 | * Give trimmings to uncached allocator | 1121 | * Give trimmings to uncached allocator |
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c index 142c3b785944..da5237d636d6 100644 --- a/arch/ia64/mm/contig.c +++ b/arch/ia64/mm/contig.c | |||
@@ -294,14 +294,6 @@ find_memory (void) | |||
294 | alloc_per_cpu_data(); | 294 | alloc_per_cpu_data(); |
295 | } | 295 | } |
296 | 296 | ||
297 | static int count_pages(u64 start, u64 end, void *arg) | ||
298 | { | ||
299 | unsigned long *count = arg; | ||
300 | |||
301 | *count += (end - start) >> PAGE_SHIFT; | ||
302 | return 0; | ||
303 | } | ||
304 | |||
305 | /* | 297 | /* |
306 | * Set up the page tables. | 298 | * Set up the page tables. |
307 | */ | 299 | */ |
@@ -312,9 +304,6 @@ paging_init (void) | |||
312 | unsigned long max_dma; | 304 | unsigned long max_dma; |
313 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | 305 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
314 | 306 | ||
315 | num_physpages = 0; | ||
316 | efi_memmap_walk(count_pages, &num_physpages); | ||
317 | |||
318 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | 307 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
319 | #ifdef CONFIG_ZONE_DMA | 308 | #ifdef CONFIG_ZONE_DMA |
320 | max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; | 309 | max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; |
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index 7253d83650bf..2de08f4d9930 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c | |||
@@ -37,7 +37,6 @@ struct early_node_data { | |||
37 | struct ia64_node_data *node_data; | 37 | struct ia64_node_data *node_data; |
38 | unsigned long pernode_addr; | 38 | unsigned long pernode_addr; |
39 | unsigned long pernode_size; | 39 | unsigned long pernode_size; |
40 | unsigned long num_physpages; | ||
41 | #ifdef CONFIG_ZONE_DMA | 40 | #ifdef CONFIG_ZONE_DMA |
42 | unsigned long num_dma_physpages; | 41 | unsigned long num_dma_physpages; |
43 | #endif | 42 | #endif |
@@ -732,7 +731,6 @@ static __init int count_node_pages(unsigned long start, unsigned long len, int n | |||
732 | { | 731 | { |
733 | unsigned long end = start + len; | 732 | unsigned long end = start + len; |
734 | 733 | ||
735 | mem_data[node].num_physpages += len >> PAGE_SHIFT; | ||
736 | #ifdef CONFIG_ZONE_DMA | 734 | #ifdef CONFIG_ZONE_DMA |
737 | if (start <= __pa(MAX_DMA_ADDRESS)) | 735 | if (start <= __pa(MAX_DMA_ADDRESS)) |
738 | mem_data[node].num_dma_physpages += | 736 | mem_data[node].num_dma_physpages += |
@@ -778,7 +776,6 @@ void __init paging_init(void) | |||
778 | #endif | 776 | #endif |
779 | 777 | ||
780 | for_each_online_node(node) { | 778 | for_each_online_node(node) { |
781 | num_physpages += mem_data[node].num_physpages; | ||
782 | pfn_offset = mem_data[node].min_pfn; | 779 | pfn_offset = mem_data[node].min_pfn; |
783 | 780 | ||
784 | #ifdef CONFIG_VIRTUAL_MEM_MAP | 781 | #ifdef CONFIG_VIRTUAL_MEM_MAP |
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index d1fe4b402601..b6f7f43424ec 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c | |||
@@ -154,9 +154,8 @@ ia64_init_addr_space (void) | |||
154 | void | 154 | void |
155 | free_initmem (void) | 155 | free_initmem (void) |
156 | { | 156 | { |
157 | free_reserved_area((unsigned long)ia64_imva(__init_begin), | 157 | free_reserved_area(ia64_imva(__init_begin), ia64_imva(__init_end), |
158 | (unsigned long)ia64_imva(__init_end), | 158 | -1, "unused kernel"); |
159 | 0, "unused kernel"); | ||
160 | } | 159 | } |
161 | 160 | ||
162 | void __init | 161 | void __init |
@@ -546,19 +545,6 @@ int __init register_active_ranges(u64 start, u64 len, int nid) | |||
546 | return 0; | 545 | return 0; |
547 | } | 546 | } |
548 | 547 | ||
549 | static int __init | ||
550 | count_reserved_pages(u64 start, u64 end, void *arg) | ||
551 | { | ||
552 | unsigned long num_reserved = 0; | ||
553 | unsigned long *count = arg; | ||
554 | |||
555 | for (; start < end; start += PAGE_SIZE) | ||
556 | if (PageReserved(virt_to_page(start))) | ||
557 | ++num_reserved; | ||
558 | *count += num_reserved; | ||
559 | return 0; | ||
560 | } | ||
561 | |||
562 | int | 548 | int |
563 | find_max_min_low_pfn (u64 start, u64 end, void *arg) | 549 | find_max_min_low_pfn (u64 start, u64 end, void *arg) |
564 | { | 550 | { |
@@ -597,8 +583,6 @@ __setup("nolwsys", nolwsys_setup); | |||
597 | void __init | 583 | void __init |
598 | mem_init (void) | 584 | mem_init (void) |
599 | { | 585 | { |
600 | long reserved_pages, codesize, datasize, initsize; | ||
601 | pg_data_t *pgdat; | ||
602 | int i; | 586 | int i; |
603 | 587 | ||
604 | BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE); | 588 | BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE); |
@@ -616,27 +600,12 @@ mem_init (void) | |||
616 | 600 | ||
617 | #ifdef CONFIG_FLATMEM | 601 | #ifdef CONFIG_FLATMEM |
618 | BUG_ON(!mem_map); | 602 | BUG_ON(!mem_map); |
619 | max_mapnr = max_low_pfn; | ||
620 | #endif | 603 | #endif |
621 | 604 | ||
605 | set_max_mapnr(max_low_pfn); | ||
622 | high_memory = __va(max_low_pfn * PAGE_SIZE); | 606 | high_memory = __va(max_low_pfn * PAGE_SIZE); |
623 | 607 | free_all_bootmem(); | |
624 | for_each_online_pgdat(pgdat) | 608 | mem_init_print_info(NULL); |
625 | if (pgdat->bdata->node_bootmem_map) | ||
626 | totalram_pages += free_all_bootmem_node(pgdat); | ||
627 | |||
628 | reserved_pages = 0; | ||
629 | efi_memmap_walk(count_reserved_pages, &reserved_pages); | ||
630 | |||
631 | codesize = (unsigned long) _etext - (unsigned long) _stext; | ||
632 | datasize = (unsigned long) _edata - (unsigned long) _etext; | ||
633 | initsize = (unsigned long) __init_end - (unsigned long) __init_begin; | ||
634 | |||
635 | printk(KERN_INFO "Memory: %luk/%luk available (%luk code, %luk reserved, " | ||
636 | "%luk data, %luk init)\n", nr_free_pages() << (PAGE_SHIFT - 10), | ||
637 | num_physpages << (PAGE_SHIFT - 10), codesize >> 10, | ||
638 | reserved_pages << (PAGE_SHIFT - 10), datasize >> 10, initsize >> 10); | ||
639 | |||
640 | 609 | ||
641 | /* | 610 | /* |
642 | * For fsyscall entrpoints with no light-weight handler, use the ordinary | 611 | * For fsyscall entrpoints with no light-weight handler, use the ordinary |
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c index 2c468e8b5853..27196303ce36 100644 --- a/arch/m32r/mm/discontig.c +++ b/arch/m32r/mm/discontig.c | |||
@@ -129,11 +129,10 @@ unsigned long __init setup_memory(void) | |||
129 | #define START_PFN(nid) (NODE_DATA(nid)->bdata->node_min_pfn) | 129 | #define START_PFN(nid) (NODE_DATA(nid)->bdata->node_min_pfn) |
130 | #define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) | 130 | #define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) |
131 | 131 | ||
132 | unsigned long __init zone_sizes_init(void) | 132 | void __init zone_sizes_init(void) |
133 | { | 133 | { |
134 | unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES]; | 134 | unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES]; |
135 | unsigned long low, start_pfn; | 135 | unsigned long low, start_pfn; |
136 | unsigned long holes = 0; | ||
137 | int nid, i; | 136 | int nid, i; |
138 | mem_prof_t *mp; | 137 | mem_prof_t *mp; |
139 | 138 | ||
@@ -147,7 +146,6 @@ unsigned long __init zone_sizes_init(void) | |||
147 | low = MAX_LOW_PFN(nid); | 146 | low = MAX_LOW_PFN(nid); |
148 | zones_size[ZONE_DMA] = low - start_pfn; | 147 | zones_size[ZONE_DMA] = low - start_pfn; |
149 | zholes_size[ZONE_DMA] = mp->holes; | 148 | zholes_size[ZONE_DMA] = mp->holes; |
150 | holes += zholes_size[ZONE_DMA]; | ||
151 | 149 | ||
152 | node_set_state(nid, N_NORMAL_MEMORY); | 150 | node_set_state(nid, N_NORMAL_MEMORY); |
153 | free_area_init_node(nid, zones_size, start_pfn, zholes_size); | 151 | free_area_init_node(nid, zones_size, start_pfn, zholes_size); |
@@ -161,6 +159,4 @@ unsigned long __init zone_sizes_init(void) | |||
161 | NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0; | 159 | NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0; |
162 | NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0; | 160 | NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0; |
163 | NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0; | 161 | NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0; |
164 | |||
165 | return holes; | ||
166 | } | 162 | } |
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c index ab4cbce91a9b..0d4146f644dc 100644 --- a/arch/m32r/mm/init.c +++ b/arch/m32r/mm/init.c | |||
@@ -40,7 +40,6 @@ unsigned long mmu_context_cache_dat; | |||
40 | #else | 40 | #else |
41 | unsigned long mmu_context_cache_dat[NR_CPUS]; | 41 | unsigned long mmu_context_cache_dat[NR_CPUS]; |
42 | #endif | 42 | #endif |
43 | static unsigned long hole_pages; | ||
44 | 43 | ||
45 | /* | 44 | /* |
46 | * function prototype | 45 | * function prototype |
@@ -57,7 +56,7 @@ void free_initrd_mem(unsigned long, unsigned long); | |||
57 | #define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) | 56 | #define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) |
58 | 57 | ||
59 | #ifndef CONFIG_DISCONTIGMEM | 58 | #ifndef CONFIG_DISCONTIGMEM |
60 | unsigned long __init zone_sizes_init(void) | 59 | void __init zone_sizes_init(void) |
61 | { | 60 | { |
62 | unsigned long zones_size[MAX_NR_ZONES] = {0, }; | 61 | unsigned long zones_size[MAX_NR_ZONES] = {0, }; |
63 | unsigned long max_dma; | 62 | unsigned long max_dma; |
@@ -83,11 +82,9 @@ unsigned long __init zone_sizes_init(void) | |||
83 | #endif /* CONFIG_MMU */ | 82 | #endif /* CONFIG_MMU */ |
84 | 83 | ||
85 | free_area_init_node(0, zones_size, start_pfn, 0); | 84 | free_area_init_node(0, zones_size, start_pfn, 0); |
86 | |||
87 | return 0; | ||
88 | } | 85 | } |
89 | #else /* CONFIG_DISCONTIGMEM */ | 86 | #else /* CONFIG_DISCONTIGMEM */ |
90 | extern unsigned long zone_sizes_init(void); | 87 | extern void zone_sizes_init(void); |
91 | #endif /* CONFIG_DISCONTIGMEM */ | 88 | #endif /* CONFIG_DISCONTIGMEM */ |
92 | 89 | ||
93 | /*======================================================================* | 90 | /*======================================================================* |
@@ -105,24 +102,7 @@ void __init paging_init(void) | |||
105 | for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++) | 102 | for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++) |
106 | pgd_val(pg_dir[i]) = 0; | 103 | pgd_val(pg_dir[i]) = 0; |
107 | #endif /* CONFIG_MMU */ | 104 | #endif /* CONFIG_MMU */ |
108 | hole_pages = zone_sizes_init(); | 105 | zone_sizes_init(); |
109 | } | ||
110 | |||
111 | int __init reservedpages_count(void) | ||
112 | { | ||
113 | int reservedpages, nid, i; | ||
114 | |||
115 | reservedpages = 0; | ||
116 | for_each_online_node(nid) { | ||
117 | unsigned long flags; | ||
118 | pgdat_resize_lock(NODE_DATA(nid), &flags); | ||
119 | for (i = 0 ; i < MAX_LOW_PFN(nid) - START_PFN(nid) ; i++) | ||
120 | if (PageReserved(nid_page_nr(nid, i))) | ||
121 | reservedpages++; | ||
122 | pgdat_resize_unlock(NODE_DATA(nid), &flags); | ||
123 | } | ||
124 | |||
125 | return reservedpages; | ||
126 | } | 106 | } |
127 | 107 | ||
128 | /*======================================================================* | 108 | /*======================================================================* |
@@ -131,48 +111,20 @@ int __init reservedpages_count(void) | |||
131 | *======================================================================*/ | 111 | *======================================================================*/ |
132 | void __init mem_init(void) | 112 | void __init mem_init(void) |
133 | { | 113 | { |
134 | int codesize, reservedpages, datasize, initsize; | ||
135 | int nid; | ||
136 | #ifndef CONFIG_MMU | 114 | #ifndef CONFIG_MMU |
137 | extern unsigned long memory_end; | 115 | extern unsigned long memory_end; |
138 | #endif | ||
139 | |||
140 | num_physpages = 0; | ||
141 | for_each_online_node(nid) | ||
142 | num_physpages += MAX_LOW_PFN(nid) - START_PFN(nid) + 1; | ||
143 | |||
144 | num_physpages -= hole_pages; | ||
145 | 116 | ||
146 | #ifndef CONFIG_DISCONTIGMEM | ||
147 | max_mapnr = num_physpages; | ||
148 | #endif /* CONFIG_DISCONTIGMEM */ | ||
149 | |||
150 | #ifdef CONFIG_MMU | ||
151 | high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0))); | ||
152 | #else | ||
153 | high_memory = (void *)(memory_end & PAGE_MASK); | 117 | high_memory = (void *)(memory_end & PAGE_MASK); |
118 | #else | ||
119 | high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0))); | ||
154 | #endif /* CONFIG_MMU */ | 120 | #endif /* CONFIG_MMU */ |
155 | 121 | ||
156 | /* clear the zero-page */ | 122 | /* clear the zero-page */ |
157 | memset(empty_zero_page, 0, PAGE_SIZE); | 123 | memset(empty_zero_page, 0, PAGE_SIZE); |
158 | 124 | ||
159 | /* this will put all low memory onto the freelists */ | 125 | set_max_mapnr(get_num_physpages()); |
160 | for_each_online_node(nid) | 126 | free_all_bootmem(); |
161 | totalram_pages += free_all_bootmem_node(NODE_DATA(nid)); | 127 | mem_init_print_info(NULL); |
162 | |||
163 | reservedpages = reservedpages_count() - hole_pages; | ||
164 | codesize = (unsigned long) &_etext - (unsigned long)&_text; | ||
165 | datasize = (unsigned long) &_edata - (unsigned long)&_etext; | ||
166 | initsize = (unsigned long) &__init_end - (unsigned long)&__init_begin; | ||
167 | |||
168 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " | ||
169 | "%dk reserved, %dk data, %dk init)\n", | ||
170 | nr_free_pages() << (PAGE_SHIFT-10), | ||
171 | num_physpages << (PAGE_SHIFT-10), | ||
172 | codesize >> 10, | ||
173 | reservedpages << (PAGE_SHIFT-10), | ||
174 | datasize >> 10, | ||
175 | initsize >> 10); | ||
176 | } | 128 | } |
177 | 129 | ||
178 | /*======================================================================* | 130 | /*======================================================================* |
@@ -181,7 +133,7 @@ void __init mem_init(void) | |||
181 | *======================================================================*/ | 133 | *======================================================================*/ |
182 | void free_initmem(void) | 134 | void free_initmem(void) |
183 | { | 135 | { |
184 | free_initmem_default(0); | 136 | free_initmem_default(-1); |
185 | } | 137 | } |
186 | 138 | ||
187 | #ifdef CONFIG_BLK_DEV_INITRD | 139 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -191,6 +143,6 @@ void free_initmem(void) | |||
191 | *======================================================================*/ | 143 | *======================================================================*/ |
192 | void free_initrd_mem(unsigned long start, unsigned long end) | 144 | void free_initrd_mem(unsigned long start, unsigned long end) |
193 | { | 145 | { |
194 | free_reserved_area(start, end, 0, "initrd"); | 146 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
195 | } | 147 | } |
196 | #endif | 148 | #endif |
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c index 1af2ca3411f6..6b4baa6e4d31 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c | |||
@@ -110,7 +110,7 @@ void __init paging_init(void) | |||
110 | void free_initmem(void) | 110 | void free_initmem(void) |
111 | { | 111 | { |
112 | #ifndef CONFIG_MMU_SUN3 | 112 | #ifndef CONFIG_MMU_SUN3 |
113 | free_initmem_default(0); | 113 | free_initmem_default(-1); |
114 | #endif /* CONFIG_MMU_SUN3 */ | 114 | #endif /* CONFIG_MMU_SUN3 */ |
115 | } | 115 | } |
116 | 116 | ||
@@ -146,38 +146,11 @@ void __init print_memmap(void) | |||
146 | MLK_ROUNDUP(__bss_start, __bss_stop)); | 146 | MLK_ROUNDUP(__bss_start, __bss_stop)); |
147 | } | 147 | } |
148 | 148 | ||
149 | void __init mem_init(void) | 149 | static inline void init_pointer_tables(void) |
150 | { | 150 | { |
151 | pg_data_t *pgdat; | 151 | #if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE) |
152 | int codepages = 0; | ||
153 | int datapages = 0; | ||
154 | int initpages = 0; | ||
155 | int i; | 152 | int i; |
156 | 153 | ||
157 | /* this will put all memory onto the freelists */ | ||
158 | totalram_pages = num_physpages = 0; | ||
159 | for_each_online_pgdat(pgdat) { | ||
160 | num_physpages += pgdat->node_present_pages; | ||
161 | |||
162 | totalram_pages += free_all_bootmem_node(pgdat); | ||
163 | for (i = 0; i < pgdat->node_spanned_pages; i++) { | ||
164 | struct page *page = pgdat->node_mem_map + i; | ||
165 | char *addr = page_to_virt(page); | ||
166 | |||
167 | if (!PageReserved(page)) | ||
168 | continue; | ||
169 | if (addr >= _text && | ||
170 | addr < _etext) | ||
171 | codepages++; | ||
172 | else if (addr >= __init_begin && | ||
173 | addr < __init_end) | ||
174 | initpages++; | ||
175 | else | ||
176 | datapages++; | ||
177 | } | ||
178 | } | ||
179 | |||
180 | #if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE) | ||
181 | /* insert pointer tables allocated so far into the tablelist */ | 154 | /* insert pointer tables allocated so far into the tablelist */ |
182 | init_pointer_table((unsigned long)kernel_pg_dir); | 155 | init_pointer_table((unsigned long)kernel_pg_dir); |
183 | for (i = 0; i < PTRS_PER_PGD; i++) { | 156 | for (i = 0; i < PTRS_PER_PGD; i++) { |
@@ -189,19 +162,20 @@ void __init mem_init(void) | |||
189 | if (zero_pgtable) | 162 | if (zero_pgtable) |
190 | init_pointer_table((unsigned long)zero_pgtable); | 163 | init_pointer_table((unsigned long)zero_pgtable); |
191 | #endif | 164 | #endif |
165 | } | ||
192 | 166 | ||
193 | pr_info("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", | 167 | void __init mem_init(void) |
194 | nr_free_pages() << (PAGE_SHIFT-10), | 168 | { |
195 | totalram_pages << (PAGE_SHIFT-10), | 169 | /* this will put all memory onto the freelists */ |
196 | codepages << (PAGE_SHIFT-10), | 170 | free_all_bootmem(); |
197 | datapages << (PAGE_SHIFT-10), | 171 | init_pointer_tables(); |
198 | initpages << (PAGE_SHIFT-10)); | 172 | mem_init_print_info(NULL); |
199 | print_memmap(); | 173 | print_memmap(); |
200 | } | 174 | } |
201 | 175 | ||
202 | #ifdef CONFIG_BLK_DEV_INITRD | 176 | #ifdef CONFIG_BLK_DEV_INITRD |
203 | void free_initrd_mem(unsigned long start, unsigned long end) | 177 | void free_initrd_mem(unsigned long start, unsigned long end) |
204 | { | 178 | { |
205 | free_reserved_area(start, end, 0, "initrd"); | 179 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
206 | } | 180 | } |
207 | #endif | 181 | #endif |
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c index d05b8455c44c..28813f164730 100644 --- a/arch/metag/mm/init.c +++ b/arch/metag/mm/init.c | |||
@@ -376,34 +376,21 @@ void __init paging_init(unsigned long mem_end) | |||
376 | 376 | ||
377 | void __init mem_init(void) | 377 | void __init mem_init(void) |
378 | { | 378 | { |
379 | int nid; | ||
380 | |||
381 | #ifdef CONFIG_HIGHMEM | 379 | #ifdef CONFIG_HIGHMEM |
382 | unsigned long tmp; | 380 | unsigned long tmp; |
381 | |||
382 | /* | ||
383 | * Explicitly reset zone->managed_pages because highmem pages are | ||
384 | * freed before calling free_all_bootmem(); | ||
385 | */ | ||
386 | reset_all_zones_managed_pages(); | ||
383 | for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) | 387 | for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) |
384 | free_highmem_page(pfn_to_page(tmp)); | 388 | free_highmem_page(pfn_to_page(tmp)); |
385 | num_physpages += totalhigh_pages; | ||
386 | #endif /* CONFIG_HIGHMEM */ | 389 | #endif /* CONFIG_HIGHMEM */ |
387 | 390 | ||
388 | for_each_online_node(nid) { | 391 | free_all_bootmem(); |
389 | pg_data_t *pgdat = NODE_DATA(nid); | 392 | mem_init_print_info(NULL); |
390 | unsigned long node_pages = 0; | ||
391 | |||
392 | num_physpages += pgdat->node_present_pages; | ||
393 | |||
394 | if (pgdat->node_spanned_pages) | ||
395 | node_pages = free_all_bootmem_node(pgdat); | ||
396 | |||
397 | totalram_pages += node_pages; | ||
398 | } | ||
399 | |||
400 | pr_info("Memory: %luk/%luk available\n", | ||
401 | (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10), | ||
402 | num_physpages << (PAGE_SHIFT - 10)); | ||
403 | |||
404 | show_mem(0); | 393 | show_mem(0); |
405 | |||
406 | return; | ||
407 | } | 394 | } |
408 | 395 | ||
409 | void free_initmem(void) | 396 | void free_initmem(void) |
@@ -414,7 +401,8 @@ void free_initmem(void) | |||
414 | #ifdef CONFIG_BLK_DEV_INITRD | 401 | #ifdef CONFIG_BLK_DEV_INITRD |
415 | void free_initrd_mem(unsigned long start, unsigned long end) | 402 | void free_initrd_mem(unsigned long start, unsigned long end) |
416 | { | 403 | { |
417 | free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); | 404 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
405 | "initrd"); | ||
418 | } | 406 | } |
419 | #endif | 407 | #endif |
420 | 408 | ||
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index 85a5ae8e9bd0..fd850879854d 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h | |||
@@ -168,7 +168,6 @@ extern int page_is_ram(unsigned long pfn); | |||
168 | # else /* CONFIG_MMU */ | 168 | # else /* CONFIG_MMU */ |
169 | # define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT) | 169 | # define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT) |
170 | # define pfn_valid(pfn) ((pfn) < (max_mapnr + ARCH_PFN_OFFSET)) | 170 | # define pfn_valid(pfn) ((pfn) < (max_mapnr + ARCH_PFN_OFFSET)) |
171 | # define VALID_PAGE(page) ((page - mem_map) < max_mapnr) | ||
172 | # endif /* CONFIG_MMU */ | 171 | # endif /* CONFIG_MMU */ |
173 | 172 | ||
174 | # endif /* __ASSEMBLY__ */ | 173 | # endif /* __ASSEMBLY__ */ |
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index b38ae3acfeb4..74c7bcc1e82d 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c | |||
@@ -71,24 +71,17 @@ static void __init highmem_init(void) | |||
71 | kmap_prot = PAGE_KERNEL; | 71 | kmap_prot = PAGE_KERNEL; |
72 | } | 72 | } |
73 | 73 | ||
74 | static unsigned long highmem_setup(void) | 74 | static void highmem_setup(void) |
75 | { | 75 | { |
76 | unsigned long pfn; | 76 | unsigned long pfn; |
77 | unsigned long reservedpages = 0; | ||
78 | 77 | ||
79 | for (pfn = max_low_pfn; pfn < max_pfn; ++pfn) { | 78 | for (pfn = max_low_pfn; pfn < max_pfn; ++pfn) { |
80 | struct page *page = pfn_to_page(pfn); | 79 | struct page *page = pfn_to_page(pfn); |
81 | 80 | ||
82 | /* FIXME not sure about */ | 81 | /* FIXME not sure about */ |
83 | if (memblock_is_reserved(pfn << PAGE_SHIFT)) | 82 | if (!memblock_is_reserved(pfn << PAGE_SHIFT)) |
84 | continue; | 83 | free_highmem_page(page); |
85 | free_highmem_page(page); | ||
86 | reservedpages++; | ||
87 | } | 84 | } |
88 | pr_info("High memory: %luk\n", | ||
89 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
90 | |||
91 | return reservedpages; | ||
92 | } | 85 | } |
93 | #endif /* CONFIG_HIGHMEM */ | 86 | #endif /* CONFIG_HIGHMEM */ |
94 | 87 | ||
@@ -167,13 +160,12 @@ void __init setup_memory(void) | |||
167 | * min_low_pfn - the first page (mm/bootmem.c - node_boot_start) | 160 | * min_low_pfn - the first page (mm/bootmem.c - node_boot_start) |
168 | * max_low_pfn | 161 | * max_low_pfn |
169 | * max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn) | 162 | * max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn) |
170 | * num_physpages - number of all pages | ||
171 | */ | 163 | */ |
172 | 164 | ||
173 | /* memory start is from the kernel end (aligned) to higher addr */ | 165 | /* memory start is from the kernel end (aligned) to higher addr */ |
174 | min_low_pfn = memory_start >> PAGE_SHIFT; /* minimum for allocation */ | 166 | min_low_pfn = memory_start >> PAGE_SHIFT; /* minimum for allocation */ |
175 | /* RAM is assumed contiguous */ | 167 | /* RAM is assumed contiguous */ |
176 | num_physpages = max_mapnr = memory_size >> PAGE_SHIFT; | 168 | max_mapnr = memory_size >> PAGE_SHIFT; |
177 | max_low_pfn = ((u64)memory_start + (u64)lowmem_size) >> PAGE_SHIFT; | 169 | max_low_pfn = ((u64)memory_start + (u64)lowmem_size) >> PAGE_SHIFT; |
178 | max_pfn = ((u64)memory_start + (u64)memory_size) >> PAGE_SHIFT; | 170 | max_pfn = ((u64)memory_start + (u64)memory_size) >> PAGE_SHIFT; |
179 | 171 | ||
@@ -235,57 +227,26 @@ void __init setup_memory(void) | |||
235 | #ifdef CONFIG_BLK_DEV_INITRD | 227 | #ifdef CONFIG_BLK_DEV_INITRD |
236 | void free_initrd_mem(unsigned long start, unsigned long end) | 228 | void free_initrd_mem(unsigned long start, unsigned long end) |
237 | { | 229 | { |
238 | free_reserved_area(start, end, 0, "initrd"); | 230 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
239 | } | 231 | } |
240 | #endif | 232 | #endif |
241 | 233 | ||
242 | void free_initmem(void) | 234 | void free_initmem(void) |
243 | { | 235 | { |
244 | free_initmem_default(0); | 236 | free_initmem_default(-1); |
245 | } | 237 | } |
246 | 238 | ||
247 | void __init mem_init(void) | 239 | void __init mem_init(void) |
248 | { | 240 | { |
249 | pg_data_t *pgdat; | ||
250 | unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize; | ||
251 | |||
252 | high_memory = (void *)__va(memory_start + lowmem_size - 1); | 241 | high_memory = (void *)__va(memory_start + lowmem_size - 1); |
253 | 242 | ||
254 | /* this will put all memory onto the freelists */ | 243 | /* this will put all memory onto the freelists */ |
255 | totalram_pages += free_all_bootmem(); | 244 | free_all_bootmem(); |
256 | |||
257 | for_each_online_pgdat(pgdat) { | ||
258 | unsigned long i; | ||
259 | struct page *page; | ||
260 | |||
261 | for (i = 0; i < pgdat->node_spanned_pages; i++) { | ||
262 | if (!pfn_valid(pgdat->node_start_pfn + i)) | ||
263 | continue; | ||
264 | page = pgdat_page_nr(pgdat, i); | ||
265 | if (PageReserved(page)) | ||
266 | reservedpages++; | ||
267 | } | ||
268 | } | ||
269 | |||
270 | #ifdef CONFIG_HIGHMEM | 245 | #ifdef CONFIG_HIGHMEM |
271 | reservedpages -= highmem_setup(); | 246 | highmem_setup(); |
272 | #endif | 247 | #endif |
273 | 248 | ||
274 | codesize = (unsigned long)&_sdata - (unsigned long)&_stext; | 249 | mem_init_print_info(NULL); |
275 | datasize = (unsigned long)&_edata - (unsigned long)&_sdata; | ||
276 | initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin; | ||
277 | bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start; | ||
278 | |||
279 | pr_info("Memory: %luk/%luk available (%luk kernel code, ", | ||
280 | nr_free_pages() << (PAGE_SHIFT-10), | ||
281 | num_physpages << (PAGE_SHIFT-10), | ||
282 | codesize >> 10); | ||
283 | pr_cont("%luk reserved, %luk data, %luk bss, %luk init)\n", | ||
284 | reservedpages << (PAGE_SHIFT-10), | ||
285 | datasize >> 10, | ||
286 | bsssize >> 10, | ||
287 | initsize >> 10); | ||
288 | |||
289 | #ifdef CONFIG_MMU | 250 | #ifdef CONFIG_MMU |
290 | pr_info("Kernel virtual memory layout:\n"); | 251 | pr_info("Kernel virtual memory layout:\n"); |
291 | pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP); | 252 | pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP); |
diff --git a/arch/mips/kernel/crash_dump.c b/arch/mips/kernel/crash_dump.c index 3be9e7bb30ff..f291cf99b03a 100644 --- a/arch/mips/kernel/crash_dump.c +++ b/arch/mips/kernel/crash_dump.c | |||
@@ -4,16 +4,6 @@ | |||
4 | #include <asm/uaccess.h> | 4 | #include <asm/uaccess.h> |
5 | #include <linux/slab.h> | 5 | #include <linux/slab.h> |
6 | 6 | ||
7 | static int __init parse_savemaxmem(char *p) | ||
8 | { | ||
9 | if (p) | ||
10 | saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1; | ||
11 | |||
12 | return 1; | ||
13 | } | ||
14 | __setup("savemaxmem=", parse_savemaxmem); | ||
15 | |||
16 | |||
17 | static void *kdump_buf_page; | 7 | static void *kdump_buf_page; |
18 | 8 | ||
19 | /** | 9 | /** |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 9b973e0af9cb..4e73f10a7519 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -359,11 +359,24 @@ void __init paging_init(void) | |||
359 | static struct kcore_list kcore_kseg0; | 359 | static struct kcore_list kcore_kseg0; |
360 | #endif | 360 | #endif |
361 | 361 | ||
362 | void __init mem_init(void) | 362 | static inline void mem_init_free_highmem(void) |
363 | { | 363 | { |
364 | unsigned long codesize, reservedpages, datasize, initsize; | 364 | #ifdef CONFIG_HIGHMEM |
365 | unsigned long tmp, ram; | 365 | unsigned long tmp; |
366 | 366 | ||
367 | for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { | ||
368 | struct page *page = pfn_to_page(tmp); | ||
369 | |||
370 | if (!page_is_ram(tmp)) | ||
371 | SetPageReserved(page); | ||
372 | else | ||
373 | free_highmem_page(page); | ||
374 | } | ||
375 | #endif | ||
376 | } | ||
377 | |||
378 | void __init mem_init(void) | ||
379 | { | ||
367 | #ifdef CONFIG_HIGHMEM | 380 | #ifdef CONFIG_HIGHMEM |
368 | #ifdef CONFIG_DISCONTIGMEM | 381 | #ifdef CONFIG_DISCONTIGMEM |
369 | #error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet" | 382 | #error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet" |
@@ -374,34 +387,10 @@ void __init mem_init(void) | |||
374 | #endif | 387 | #endif |
375 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); | 388 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); |
376 | 389 | ||
377 | totalram_pages += free_all_bootmem(); | 390 | free_all_bootmem(); |
378 | setup_zero_pages(); /* Setup zeroed pages. */ | 391 | setup_zero_pages(); /* Setup zeroed pages. */ |
379 | 392 | mem_init_free_highmem(); | |
380 | reservedpages = ram = 0; | 393 | mem_init_print_info(NULL); |
381 | for (tmp = 0; tmp < max_low_pfn; tmp++) | ||
382 | if (page_is_ram(tmp) && pfn_valid(tmp)) { | ||
383 | ram++; | ||
384 | if (PageReserved(pfn_to_page(tmp))) | ||
385 | reservedpages++; | ||
386 | } | ||
387 | num_physpages = ram; | ||
388 | |||
389 | #ifdef CONFIG_HIGHMEM | ||
390 | for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { | ||
391 | struct page *page = pfn_to_page(tmp); | ||
392 | |||
393 | if (!page_is_ram(tmp)) { | ||
394 | SetPageReserved(page); | ||
395 | continue; | ||
396 | } | ||
397 | free_highmem_page(page); | ||
398 | } | ||
399 | num_physpages += totalhigh_pages; | ||
400 | #endif | ||
401 | |||
402 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
403 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
404 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
405 | 394 | ||
406 | #ifdef CONFIG_64BIT | 395 | #ifdef CONFIG_64BIT |
407 | if ((unsigned long) &_text > (unsigned long) CKSEG0) | 396 | if ((unsigned long) &_text > (unsigned long) CKSEG0) |
@@ -410,16 +399,6 @@ void __init mem_init(void) | |||
410 | kclist_add(&kcore_kseg0, (void *) CKSEG0, | 399 | kclist_add(&kcore_kseg0, (void *) CKSEG0, |
411 | 0x80000000 - 4, KCORE_TEXT); | 400 | 0x80000000 - 4, KCORE_TEXT); |
412 | #endif | 401 | #endif |
413 | |||
414 | printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " | ||
415 | "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", | ||
416 | nr_free_pages() << (PAGE_SHIFT-10), | ||
417 | ram << (PAGE_SHIFT-10), | ||
418 | codesize >> 10, | ||
419 | reservedpages << (PAGE_SHIFT-10), | ||
420 | datasize >> 10, | ||
421 | initsize >> 10, | ||
422 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
423 | } | 402 | } |
424 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | 403 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ |
425 | 404 | ||
@@ -440,7 +419,8 @@ void free_init_pages(const char *what, unsigned long begin, unsigned long end) | |||
440 | #ifdef CONFIG_BLK_DEV_INITRD | 419 | #ifdef CONFIG_BLK_DEV_INITRD |
441 | void free_initrd_mem(unsigned long start, unsigned long end) | 420 | void free_initrd_mem(unsigned long start, unsigned long end) |
442 | { | 421 | { |
443 | free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); | 422 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
423 | "initrd"); | ||
444 | } | 424 | } |
445 | #endif | 425 | #endif |
446 | 426 | ||
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c index 879077b01155..cb1ef9984069 100644 --- a/arch/mips/pci/pci-lantiq.c +++ b/arch/mips/pci/pci-lantiq.c | |||
@@ -89,7 +89,7 @@ static inline u32 ltq_calc_bar11mask(void) | |||
89 | u32 mem, bar11mask; | 89 | u32 mem, bar11mask; |
90 | 90 | ||
91 | /* BAR11MASK value depends on available memory on system. */ | 91 | /* BAR11MASK value depends on available memory on system. */ |
92 | mem = num_physpages * PAGE_SIZE; | 92 | mem = get_num_physpages() * PAGE_SIZE; |
93 | bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8; | 93 | bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8; |
94 | 94 | ||
95 | return bar11mask; | 95 | return bar11mask; |
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index 1230f56429d7..a95c00f5fb96 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c | |||
@@ -357,8 +357,6 @@ static void __init szmem(void) | |||
357 | int slot; | 357 | int slot; |
358 | cnodeid_t node; | 358 | cnodeid_t node; |
359 | 359 | ||
360 | num_physpages = 0; | ||
361 | |||
362 | for_each_online_node(node) { | 360 | for_each_online_node(node) { |
363 | nodebytes = 0; | 361 | nodebytes = 0; |
364 | for (slot = 0; slot < MAX_MEM_SLOTS; slot++) { | 362 | for (slot = 0; slot < MAX_MEM_SLOTS; slot++) { |
@@ -381,7 +379,6 @@ static void __init szmem(void) | |||
381 | slot = MAX_MEM_SLOTS; | 379 | slot = MAX_MEM_SLOTS; |
382 | continue; | 380 | continue; |
383 | } | 381 | } |
384 | num_physpages += slot_psize; | ||
385 | memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)), | 382 | memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)), |
386 | PFN_PHYS(slot_psize), node); | 383 | PFN_PHYS(slot_psize), node); |
387 | } | 384 | } |
@@ -480,32 +477,8 @@ void __init paging_init(void) | |||
480 | 477 | ||
481 | void __init mem_init(void) | 478 | void __init mem_init(void) |
482 | { | 479 | { |
483 | unsigned long codesize, datasize, initsize, tmp; | 480 | high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT); |
484 | unsigned node; | 481 | free_all_bootmem(); |
485 | |||
486 | high_memory = (void *) __va(num_physpages << PAGE_SHIFT); | ||
487 | |||
488 | for_each_online_node(node) { | ||
489 | /* | ||
490 | * This will free up the bootmem, ie, slot 0 memory. | ||
491 | */ | ||
492 | totalram_pages += free_all_bootmem_node(NODE_DATA(node)); | ||
493 | } | ||
494 | |||
495 | setup_zero_pages(); /* This comes from node 0 */ | 482 | setup_zero_pages(); /* This comes from node 0 */ |
496 | 483 | mem_init_print_info(NULL); | |
497 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
498 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
499 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
500 | |||
501 | tmp = nr_free_pages(); | ||
502 | printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " | ||
503 | "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", | ||
504 | tmp << (PAGE_SHIFT-10), | ||
505 | num_physpages << (PAGE_SHIFT-10), | ||
506 | codesize >> 10, | ||
507 | (num_physpages - tmp) << (PAGE_SHIFT-10), | ||
508 | datasize >> 10, | ||
509 | initsize >> 10, | ||
510 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
511 | } | 484 | } |
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c index 5a8ace63a6b4..97a1ec0beeec 100644 --- a/arch/mn10300/mm/init.c +++ b/arch/mn10300/mm/init.c | |||
@@ -99,43 +99,21 @@ void __init paging_init(void) | |||
99 | */ | 99 | */ |
100 | void __init mem_init(void) | 100 | void __init mem_init(void) |
101 | { | 101 | { |
102 | int codesize, reservedpages, datasize, initsize; | ||
103 | int tmp; | ||
104 | |||
105 | BUG_ON(!mem_map); | 102 | BUG_ON(!mem_map); |
106 | 103 | ||
107 | #define START_PFN (contig_page_data.bdata->node_min_pfn) | 104 | #define START_PFN (contig_page_data.bdata->node_min_pfn) |
108 | #define MAX_LOW_PFN (contig_page_data.bdata->node_low_pfn) | 105 | #define MAX_LOW_PFN (contig_page_data.bdata->node_low_pfn) |
109 | 106 | ||
110 | max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN; | 107 | max_mapnr = MAX_LOW_PFN - START_PFN; |
111 | high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE); | 108 | high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE); |
112 | 109 | ||
113 | /* clear the zero-page */ | 110 | /* clear the zero-page */ |
114 | memset(empty_zero_page, 0, PAGE_SIZE); | 111 | memset(empty_zero_page, 0, PAGE_SIZE); |
115 | 112 | ||
116 | /* this will put all low memory onto the freelists */ | 113 | /* this will put all low memory onto the freelists */ |
117 | totalram_pages += free_all_bootmem(); | 114 | free_all_bootmem(); |
118 | 115 | ||
119 | reservedpages = 0; | 116 | mem_init_print_info(NULL); |
120 | for (tmp = 0; tmp < num_physpages; tmp++) | ||
121 | if (PageReserved(&mem_map[tmp])) | ||
122 | reservedpages++; | ||
123 | |||
124 | codesize = (unsigned long) &_etext - (unsigned long) &_stext; | ||
125 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
126 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
127 | |||
128 | printk(KERN_INFO | ||
129 | "Memory: %luk/%luk available" | ||
130 | " (%dk kernel code, %dk reserved, %dk data, %dk init," | ||
131 | " %ldk highmem)\n", | ||
132 | nr_free_pages() << (PAGE_SHIFT - 10), | ||
133 | max_mapnr << (PAGE_SHIFT - 10), | ||
134 | codesize >> 10, | ||
135 | reservedpages << (PAGE_SHIFT - 10), | ||
136 | datasize >> 10, | ||
137 | initsize >> 10, | ||
138 | totalhigh_pages << (PAGE_SHIFT - 10)); | ||
139 | } | 117 | } |
140 | 118 | ||
141 | /* | 119 | /* |
@@ -152,6 +130,7 @@ void free_initmem(void) | |||
152 | #ifdef CONFIG_BLK_DEV_INITRD | 130 | #ifdef CONFIG_BLK_DEV_INITRD |
153 | void free_initrd_mem(unsigned long start, unsigned long end) | 131 | void free_initrd_mem(unsigned long start, unsigned long end) |
154 | { | 132 | { |
155 | free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); | 133 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
134 | "initrd"); | ||
156 | } | 135 | } |
157 | #endif | 136 | #endif |
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c index b3cbc6703837..7f94652311d7 100644 --- a/arch/openrisc/mm/init.c +++ b/arch/openrisc/mm/init.c | |||
@@ -202,56 +202,20 @@ void __init paging_init(void) | |||
202 | 202 | ||
203 | /* References to section boundaries */ | 203 | /* References to section boundaries */ |
204 | 204 | ||
205 | static int __init free_pages_init(void) | ||
206 | { | ||
207 | int reservedpages, pfn; | ||
208 | |||
209 | /* this will put all low memory onto the freelists */ | ||
210 | totalram_pages = free_all_bootmem(); | ||
211 | |||
212 | reservedpages = 0; | ||
213 | for (pfn = 0; pfn < max_low_pfn; pfn++) { | ||
214 | /* | ||
215 | * Only count reserved RAM pages | ||
216 | */ | ||
217 | if (PageReserved(mem_map + pfn)) | ||
218 | reservedpages++; | ||
219 | } | ||
220 | |||
221 | return reservedpages; | ||
222 | } | ||
223 | |||
224 | static void __init set_max_mapnr_init(void) | ||
225 | { | ||
226 | max_mapnr = num_physpages = max_low_pfn; | ||
227 | } | ||
228 | |||
229 | void __init mem_init(void) | 205 | void __init mem_init(void) |
230 | { | 206 | { |
231 | int codesize, reservedpages, datasize, initsize; | ||
232 | |||
233 | BUG_ON(!mem_map); | 207 | BUG_ON(!mem_map); |
234 | 208 | ||
235 | set_max_mapnr_init(); | 209 | max_mapnr = max_low_pfn; |
236 | |||
237 | high_memory = (void *)__va(max_low_pfn * PAGE_SIZE); | 210 | high_memory = (void *)__va(max_low_pfn * PAGE_SIZE); |
238 | 211 | ||
239 | /* clear the zero-page */ | 212 | /* clear the zero-page */ |
240 | memset((void *)empty_zero_page, 0, PAGE_SIZE); | 213 | memset((void *)empty_zero_page, 0, PAGE_SIZE); |
241 | 214 | ||
242 | reservedpages = free_pages_init(); | 215 | /* this will put all low memory onto the freelists */ |
243 | 216 | free_all_bootmem(); | |
244 | codesize = (unsigned long)&_etext - (unsigned long)&_stext; | ||
245 | datasize = (unsigned long)&_edata - (unsigned long)&_etext; | ||
246 | initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin; | ||
247 | 217 | ||
248 | printk(KERN_INFO | 218 | mem_init_print_info(NULL); |
249 | "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", | ||
250 | (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10), | ||
251 | max_mapnr << (PAGE_SHIFT - 10), codesize >> 10, | ||
252 | reservedpages << (PAGE_SHIFT - 10), datasize >> 10, | ||
253 | initsize >> 10, (unsigned long)(0 << (PAGE_SHIFT - 10)) | ||
254 | ); | ||
255 | 219 | ||
256 | printk("mem_init_done ...........................................\n"); | 220 | printk("mem_init_done ...........................................\n"); |
257 | mem_init_done = 1; | 221 | mem_init_done = 1; |
@@ -261,11 +225,11 @@ void __init mem_init(void) | |||
261 | #ifdef CONFIG_BLK_DEV_INITRD | 225 | #ifdef CONFIG_BLK_DEV_INITRD |
262 | void free_initrd_mem(unsigned long start, unsigned long end) | 226 | void free_initrd_mem(unsigned long start, unsigned long end) |
263 | { | 227 | { |
264 | free_reserved_area(start, end, 0, "initrd"); | 228 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
265 | } | 229 | } |
266 | #endif | 230 | #endif |
267 | 231 | ||
268 | void free_initmem(void) | 232 | void free_initmem(void) |
269 | { | 233 | { |
270 | free_initmem_default(0); | 234 | free_initmem_default(-1); |
271 | } | 235 | } |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 505b56c6b9b9..b0f96c0e6316 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -214,7 +214,6 @@ static void __init setup_bootmem(void) | |||
214 | mem_limit_func(); /* check for "mem=" argument */ | 214 | mem_limit_func(); /* check for "mem=" argument */ |
215 | 215 | ||
216 | mem_max = 0; | 216 | mem_max = 0; |
217 | num_physpages = 0; | ||
218 | for (i = 0; i < npmem_ranges; i++) { | 217 | for (i = 0; i < npmem_ranges; i++) { |
219 | unsigned long rsize; | 218 | unsigned long rsize; |
220 | 219 | ||
@@ -229,10 +228,8 @@ static void __init setup_bootmem(void) | |||
229 | npmem_ranges = i + 1; | 228 | npmem_ranges = i + 1; |
230 | mem_max = mem_limit; | 229 | mem_max = mem_limit; |
231 | } | 230 | } |
232 | num_physpages += pmem_ranges[i].pages; | ||
233 | break; | 231 | break; |
234 | } | 232 | } |
235 | num_physpages += pmem_ranges[i].pages; | ||
236 | mem_max += rsize; | 233 | mem_max += rsize; |
237 | } | 234 | } |
238 | 235 | ||
@@ -532,7 +529,7 @@ void free_initmem(void) | |||
532 | * pages are no-longer executable */ | 529 | * pages are no-longer executable */ |
533 | flush_icache_range(init_begin, init_end); | 530 | flush_icache_range(init_begin, init_end); |
534 | 531 | ||
535 | num_physpages += free_initmem_default(0); | 532 | free_initmem_default(-1); |
536 | 533 | ||
537 | /* set up a new led state on systems shipped LED State panel */ | 534 | /* set up a new led state on systems shipped LED State panel */ |
538 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); | 535 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); |
@@ -580,8 +577,6 @@ unsigned long pcxl_dma_start __read_mostly; | |||
580 | 577 | ||
581 | void __init mem_init(void) | 578 | void __init mem_init(void) |
582 | { | 579 | { |
583 | int codesize, reservedpages, datasize, initsize; | ||
584 | |||
585 | /* Do sanity checks on page table constants */ | 580 | /* Do sanity checks on page table constants */ |
586 | BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t)); | 581 | BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t)); |
587 | BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t)); | 582 | BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t)); |
@@ -590,45 +585,8 @@ void __init mem_init(void) | |||
590 | > BITS_PER_LONG); | 585 | > BITS_PER_LONG); |
591 | 586 | ||
592 | high_memory = __va((max_pfn << PAGE_SHIFT)); | 587 | high_memory = __va((max_pfn << PAGE_SHIFT)); |
593 | 588 | set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1); | |
594 | #ifndef CONFIG_DISCONTIGMEM | 589 | free_all_bootmem(); |
595 | max_mapnr = page_to_pfn(virt_to_page(high_memory - 1)) + 1; | ||
596 | totalram_pages += free_all_bootmem(); | ||
597 | #else | ||
598 | { | ||
599 | int i; | ||
600 | |||
601 | for (i = 0; i < npmem_ranges; i++) | ||
602 | totalram_pages += free_all_bootmem_node(NODE_DATA(i)); | ||
603 | } | ||
604 | #endif | ||
605 | |||
606 | codesize = (unsigned long)_etext - (unsigned long)_text; | ||
607 | datasize = (unsigned long)_edata - (unsigned long)_etext; | ||
608 | initsize = (unsigned long)__init_end - (unsigned long)__init_begin; | ||
609 | |||
610 | reservedpages = 0; | ||
611 | { | ||
612 | unsigned long pfn; | ||
613 | #ifdef CONFIG_DISCONTIGMEM | ||
614 | int i; | ||
615 | |||
616 | for (i = 0; i < npmem_ranges; i++) { | ||
617 | for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) { | ||
618 | if (PageReserved(pfn_to_page(pfn))) | ||
619 | reservedpages++; | ||
620 | } | ||
621 | } | ||
622 | #else /* !CONFIG_DISCONTIGMEM */ | ||
623 | for (pfn = 0; pfn < max_pfn; pfn++) { | ||
624 | /* | ||
625 | * Only count reserved RAM pages | ||
626 | */ | ||
627 | if (PageReserved(pfn_to_page(pfn))) | ||
628 | reservedpages++; | ||
629 | } | ||
630 | #endif | ||
631 | } | ||
632 | 590 | ||
633 | #ifdef CONFIG_PA11 | 591 | #ifdef CONFIG_PA11 |
634 | if (hppa_dma_ops == &pcxl_dma_ops) { | 592 | if (hppa_dma_ops == &pcxl_dma_ops) { |
@@ -643,15 +601,7 @@ void __init mem_init(void) | |||
643 | parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START); | 601 | parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START); |
644 | #endif | 602 | #endif |
645 | 603 | ||
646 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", | 604 | mem_init_print_info(NULL); |
647 | nr_free_pages() << (PAGE_SHIFT-10), | ||
648 | num_physpages << (PAGE_SHIFT-10), | ||
649 | codesize >> 10, | ||
650 | reservedpages << (PAGE_SHIFT-10), | ||
651 | datasize >> 10, | ||
652 | initsize >> 10 | ||
653 | ); | ||
654 | |||
655 | #ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */ | 605 | #ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */ |
656 | printk("virtual kernel memory layout:\n" | 606 | printk("virtual kernel memory layout:\n" |
657 | " vmalloc : 0x%p - 0x%p (%4ld MB)\n" | 607 | " vmalloc : 0x%p - 0x%p (%4ld MB)\n" |
@@ -1101,6 +1051,6 @@ void flush_tlb_all(void) | |||
1101 | #ifdef CONFIG_BLK_DEV_INITRD | 1051 | #ifdef CONFIG_BLK_DEV_INITRD |
1102 | void free_initrd_mem(unsigned long start, unsigned long end) | 1052 | void free_initrd_mem(unsigned long start, unsigned long end) |
1103 | { | 1053 | { |
1104 | num_physpages += free_reserved_area(start, end, 0, "initrd"); | 1054 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
1105 | } | 1055 | } |
1106 | #endif | 1056 | #endif |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 9ec3fe174cba..779a78c26435 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -69,16 +69,6 @@ void __init setup_kdump_trampoline(void) | |||
69 | } | 69 | } |
70 | #endif /* CONFIG_NONSTATIC_KERNEL */ | 70 | #endif /* CONFIG_NONSTATIC_KERNEL */ |
71 | 71 | ||
72 | static int __init parse_savemaxmem(char *p) | ||
73 | { | ||
74 | if (p) | ||
75 | saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1; | ||
76 | |||
77 | return 1; | ||
78 | } | ||
79 | __setup("savemaxmem=", parse_savemaxmem); | ||
80 | |||
81 | |||
82 | static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize, | 72 | static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize, |
83 | unsigned long offset, int userbuf) | 73 | unsigned long offset, int userbuf) |
84 | { | 74 | { |
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c index 6782221d49bd..db28032e320e 100644 --- a/arch/powerpc/kernel/kvm.c +++ b/arch/powerpc/kernel/kvm.c | |||
@@ -750,13 +750,8 @@ EXPORT_SYMBOL_GPL(kvm_hypercall); | |||
750 | 750 | ||
751 | static __init void kvm_free_tmp(void) | 751 | static __init void kvm_free_tmp(void) |
752 | { | 752 | { |
753 | unsigned long start, end; | 753 | free_reserved_area(&kvm_tmp[kvm_tmp_index], |
754 | 754 | &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL); | |
755 | start = (ulong)&kvm_tmp[kvm_tmp_index + (PAGE_SIZE - 1)] & PAGE_MASK; | ||
756 | end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK; | ||
757 | |||
758 | /* Free the tmp space we don't need */ | ||
759 | free_reserved_area(start, end, 0, NULL); | ||
760 | } | 755 | } |
761 | 756 | ||
762 | static int __init kvm_guest_init(void) | 757 | static int __init kvm_guest_init(void) |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 77fdd2cef33b..4210549ac95e 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -357,7 +357,7 @@ void add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages) | |||
357 | int alloc_bootmem_huge_page(struct hstate *hstate) | 357 | int alloc_bootmem_huge_page(struct hstate *hstate) |
358 | { | 358 | { |
359 | struct huge_bootmem_page *m; | 359 | struct huge_bootmem_page *m; |
360 | int idx = shift_to_mmu_psize(hstate->order + PAGE_SHIFT); | 360 | int idx = shift_to_mmu_psize(huge_page_shift(hstate)); |
361 | int nr_gpages = gpage_freearray[idx].nr_gpages; | 361 | int nr_gpages = gpage_freearray[idx].nr_gpages; |
362 | 362 | ||
363 | if (nr_gpages == 0) | 363 | if (nr_gpages == 0) |
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 0988a26e0413..1cb1ea133a2c 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -299,47 +299,13 @@ void __init paging_init(void) | |||
299 | 299 | ||
300 | void __init mem_init(void) | 300 | void __init mem_init(void) |
301 | { | 301 | { |
302 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
303 | int nid; | ||
304 | #endif | ||
305 | pg_data_t *pgdat; | ||
306 | unsigned long i; | ||
307 | struct page *page; | ||
308 | unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize; | ||
309 | |||
310 | #ifdef CONFIG_SWIOTLB | 302 | #ifdef CONFIG_SWIOTLB |
311 | swiotlb_init(0); | 303 | swiotlb_init(0); |
312 | #endif | 304 | #endif |
313 | 305 | ||
314 | num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT; | ||
315 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); | 306 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); |
316 | 307 | set_max_mapnr(max_pfn); | |
317 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 308 | free_all_bootmem(); |
318 | for_each_online_node(nid) { | ||
319 | if (NODE_DATA(nid)->node_spanned_pages != 0) { | ||
320 | printk("freeing bootmem node %d\n", nid); | ||
321 | totalram_pages += | ||
322 | free_all_bootmem_node(NODE_DATA(nid)); | ||
323 | } | ||
324 | } | ||
325 | #else | ||
326 | max_mapnr = max_pfn; | ||
327 | totalram_pages += free_all_bootmem(); | ||
328 | #endif | ||
329 | for_each_online_pgdat(pgdat) { | ||
330 | for (i = 0; i < pgdat->node_spanned_pages; i++) { | ||
331 | if (!pfn_valid(pgdat->node_start_pfn + i)) | ||
332 | continue; | ||
333 | page = pgdat_page_nr(pgdat, i); | ||
334 | if (PageReserved(page)) | ||
335 | reservedpages++; | ||
336 | } | ||
337 | } | ||
338 | |||
339 | codesize = (unsigned long)&_sdata - (unsigned long)&_stext; | ||
340 | datasize = (unsigned long)&_edata - (unsigned long)&_sdata; | ||
341 | initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin; | ||
342 | bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start; | ||
343 | 309 | ||
344 | #ifdef CONFIG_HIGHMEM | 310 | #ifdef CONFIG_HIGHMEM |
345 | { | 311 | { |
@@ -349,13 +315,9 @@ void __init mem_init(void) | |||
349 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { | 315 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { |
350 | phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT; | 316 | phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT; |
351 | struct page *page = pfn_to_page(pfn); | 317 | struct page *page = pfn_to_page(pfn); |
352 | if (memblock_is_reserved(paddr)) | 318 | if (!memblock_is_reserved(paddr)) |
353 | continue; | 319 | free_highmem_page(page); |
354 | free_highmem_page(page); | ||
355 | reservedpages--; | ||
356 | } | 320 | } |
357 | printk(KERN_DEBUG "High memory: %luk\n", | ||
358 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
359 | } | 321 | } |
360 | #endif /* CONFIG_HIGHMEM */ | 322 | #endif /* CONFIG_HIGHMEM */ |
361 | 323 | ||
@@ -368,16 +330,7 @@ void __init mem_init(void) | |||
368 | (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1; | 330 | (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1; |
369 | #endif | 331 | #endif |
370 | 332 | ||
371 | printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, " | 333 | mem_init_print_info(NULL); |
372 | "%luk reserved, %luk data, %luk bss, %luk init)\n", | ||
373 | nr_free_pages() << (PAGE_SHIFT-10), | ||
374 | num_physpages << (PAGE_SHIFT-10), | ||
375 | codesize >> 10, | ||
376 | reservedpages << (PAGE_SHIFT-10), | ||
377 | datasize >> 10, | ||
378 | bsssize >> 10, | ||
379 | initsize >> 10); | ||
380 | |||
381 | #ifdef CONFIG_PPC32 | 334 | #ifdef CONFIG_PPC32 |
382 | pr_info("Kernel virtual memory layout:\n"); | 335 | pr_info("Kernel virtual memory layout:\n"); |
383 | pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP); | 336 | pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP); |
@@ -407,7 +360,7 @@ void free_initmem(void) | |||
407 | #ifdef CONFIG_BLK_DEV_INITRD | 360 | #ifdef CONFIG_BLK_DEV_INITRD |
408 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 361 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
409 | { | 362 | { |
410 | free_reserved_area(start, end, 0, "initrd"); | 363 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
411 | } | 364 | } |
412 | #endif | 365 | #endif |
413 | 366 | ||
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 0a49095104c9..497451ec5e26 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -719,10 +719,6 @@ static void reserve_oldmem(void) | |||
719 | } | 719 | } |
720 | create_mem_hole(memory_chunk, OLDMEM_BASE, OLDMEM_SIZE); | 720 | create_mem_hole(memory_chunk, OLDMEM_BASE, OLDMEM_SIZE); |
721 | create_mem_hole(memory_chunk, OLDMEM_SIZE, real_size - OLDMEM_SIZE); | 721 | create_mem_hole(memory_chunk, OLDMEM_SIZE, real_size - OLDMEM_SIZE); |
722 | if (OLDMEM_BASE + OLDMEM_SIZE == real_size) | ||
723 | saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1; | ||
724 | else | ||
725 | saved_max_pfn = PFN_DOWN(real_size) - 1; | ||
726 | #endif | 722 | #endif |
727 | } | 723 | } |
728 | 724 | ||
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 89ebae4008f2..ce36ea80e4f9 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -135,30 +135,17 @@ void __init paging_init(void) | |||
135 | 135 | ||
136 | void __init mem_init(void) | 136 | void __init mem_init(void) |
137 | { | 137 | { |
138 | unsigned long codesize, reservedpages, datasize, initsize; | 138 | max_mapnr = max_low_pfn; |
139 | |||
140 | max_mapnr = num_physpages = max_low_pfn; | ||
141 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); | 139 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); |
142 | 140 | ||
143 | /* Setup guest page hinting */ | 141 | /* Setup guest page hinting */ |
144 | cmma_init(); | 142 | cmma_init(); |
145 | 143 | ||
146 | /* this will put all low memory onto the freelists */ | 144 | /* this will put all low memory onto the freelists */ |
147 | totalram_pages += free_all_bootmem(); | 145 | free_all_bootmem(); |
148 | setup_zero_pages(); /* Setup zeroed pages. */ | 146 | setup_zero_pages(); /* Setup zeroed pages. */ |
149 | 147 | ||
150 | reservedpages = 0; | 148 | mem_init_print_info(NULL); |
151 | |||
152 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
153 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
154 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
155 | printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n", | ||
156 | nr_free_pages() << (PAGE_SHIFT-10), | ||
157 | max_mapnr << (PAGE_SHIFT-10), | ||
158 | codesize >> 10, | ||
159 | reservedpages << (PAGE_SHIFT-10), | ||
160 | datasize >>10, | ||
161 | initsize >> 10); | ||
162 | printk("Write protected kernel read-only data: %#lx - %#lx\n", | 149 | printk("Write protected kernel read-only data: %#lx - %#lx\n", |
163 | (unsigned long)&_stext, | 150 | (unsigned long)&_stext, |
164 | PFN_ALIGN((unsigned long)&_eshared) - 1); | 151 | PFN_ALIGN((unsigned long)&_eshared) - 1); |
@@ -166,13 +153,14 @@ void __init mem_init(void) | |||
166 | 153 | ||
167 | void free_initmem(void) | 154 | void free_initmem(void) |
168 | { | 155 | { |
169 | free_initmem_default(0); | 156 | free_initmem_default(POISON_FREE_INITMEM); |
170 | } | 157 | } |
171 | 158 | ||
172 | #ifdef CONFIG_BLK_DEV_INITRD | 159 | #ifdef CONFIG_BLK_DEV_INITRD |
173 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 160 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
174 | { | 161 | { |
175 | free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); | 162 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
163 | "initrd"); | ||
176 | } | 164 | } |
177 | #endif | 165 | #endif |
178 | 166 | ||
diff --git a/arch/score/kernel/vmlinux.lds.S b/arch/score/kernel/vmlinux.lds.S index eebcbaa4e978..7274b5c4287e 100644 --- a/arch/score/kernel/vmlinux.lds.S +++ b/arch/score/kernel/vmlinux.lds.S | |||
@@ -49,6 +49,7 @@ SECTIONS | |||
49 | } | 49 | } |
50 | 50 | ||
51 | . = ALIGN(16); | 51 | . = ALIGN(16); |
52 | _sdata = .; /* Start of data section */ | ||
52 | RODATA | 53 | RODATA |
53 | 54 | ||
54 | EXCEPTION_TABLE(16) | 55 | EXCEPTION_TABLE(16) |
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c index 0940682ab38b..9fbce49ad3bd 100644 --- a/arch/score/mm/init.c +++ b/arch/score/mm/init.c | |||
@@ -75,40 +75,19 @@ void __init paging_init(void) | |||
75 | 75 | ||
76 | void __init mem_init(void) | 76 | void __init mem_init(void) |
77 | { | 77 | { |
78 | unsigned long codesize, reservedpages, datasize, initsize; | ||
79 | unsigned long tmp, ram = 0; | ||
80 | |||
81 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); | 78 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); |
82 | totalram_pages += free_all_bootmem(); | 79 | free_all_bootmem(); |
83 | setup_zero_page(); /* Setup zeroed pages. */ | 80 | setup_zero_page(); /* Setup zeroed pages. */ |
84 | reservedpages = 0; | 81 | |
85 | 82 | mem_init_print_info(NULL); | |
86 | for (tmp = 0; tmp < max_low_pfn; tmp++) | ||
87 | if (page_is_ram(tmp)) { | ||
88 | ram++; | ||
89 | if (PageReserved(pfn_to_page(tmp))) | ||
90 | reservedpages++; | ||
91 | } | ||
92 | |||
93 | num_physpages = ram; | ||
94 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
95 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
96 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
97 | |||
98 | printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " | ||
99 | "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", | ||
100 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | ||
101 | ram << (PAGE_SHIFT-10), codesize >> 10, | ||
102 | reservedpages << (PAGE_SHIFT-10), datasize >> 10, | ||
103 | initsize >> 10, | ||
104 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
105 | } | 83 | } |
106 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | 84 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ |
107 | 85 | ||
108 | #ifdef CONFIG_BLK_DEV_INITRD | 86 | #ifdef CONFIG_BLK_DEV_INITRD |
109 | void free_initrd_mem(unsigned long start, unsigned long end) | 87 | void free_initrd_mem(unsigned long start, unsigned long end) |
110 | { | 88 | { |
111 | free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); | 89 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
90 | "initrd"); | ||
112 | } | 91 | } |
113 | #endif | 92 | #endif |
114 | 93 | ||
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 20f9ead650d3..33890fd267cb 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -407,30 +407,16 @@ unsigned int mem_init_done = 0; | |||
407 | 407 | ||
408 | void __init mem_init(void) | 408 | void __init mem_init(void) |
409 | { | 409 | { |
410 | int codesize, datasize, initsize; | 410 | pg_data_t *pgdat; |
411 | int nid; | ||
412 | 411 | ||
413 | iommu_init(); | 412 | iommu_init(); |
414 | 413 | ||
415 | num_physpages = 0; | ||
416 | high_memory = NULL; | 414 | high_memory = NULL; |
415 | for_each_online_pgdat(pgdat) | ||
416 | high_memory = max_t(void *, high_memory, | ||
417 | __va(pgdat_end_pfn(pgdat) << PAGE_SHIFT)); | ||
417 | 418 | ||
418 | for_each_online_node(nid) { | 419 | free_all_bootmem(); |
419 | pg_data_t *pgdat = NODE_DATA(nid); | ||
420 | void *node_high_memory; | ||
421 | |||
422 | num_physpages += pgdat->node_present_pages; | ||
423 | |||
424 | if (pgdat->node_spanned_pages) | ||
425 | totalram_pages += free_all_bootmem_node(pgdat); | ||
426 | |||
427 | |||
428 | node_high_memory = (void *)__va((pgdat->node_start_pfn + | ||
429 | pgdat->node_spanned_pages) << | ||
430 | PAGE_SHIFT); | ||
431 | if (node_high_memory > high_memory) | ||
432 | high_memory = node_high_memory; | ||
433 | } | ||
434 | 420 | ||
435 | /* Set this up early, so we can take care of the zero page */ | 421 | /* Set this up early, so we can take care of the zero page */ |
436 | cpu_cache_init(); | 422 | cpu_cache_init(); |
@@ -441,19 +427,8 @@ void __init mem_init(void) | |||
441 | 427 | ||
442 | vsyscall_init(); | 428 | vsyscall_init(); |
443 | 429 | ||
444 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | 430 | mem_init_print_info(NULL); |
445 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | 431 | pr_info("virtual kernel memory layout:\n" |
446 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
447 | |||
448 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " | ||
449 | "%dk data, %dk init)\n", | ||
450 | nr_free_pages() << (PAGE_SHIFT-10), | ||
451 | num_physpages << (PAGE_SHIFT-10), | ||
452 | codesize >> 10, | ||
453 | datasize >> 10, | ||
454 | initsize >> 10); | ||
455 | |||
456 | printk(KERN_INFO "virtual kernel memory layout:\n" | ||
457 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | 432 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" |
458 | #ifdef CONFIG_HIGHMEM | 433 | #ifdef CONFIG_HIGHMEM |
459 | " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | 434 | " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n" |
@@ -499,13 +474,13 @@ void __init mem_init(void) | |||
499 | 474 | ||
500 | void free_initmem(void) | 475 | void free_initmem(void) |
501 | { | 476 | { |
502 | free_initmem_default(0); | 477 | free_initmem_default(-1); |
503 | } | 478 | } |
504 | 479 | ||
505 | #ifdef CONFIG_BLK_DEV_INITRD | 480 | #ifdef CONFIG_BLK_DEV_INITRD |
506 | void free_initrd_mem(unsigned long start, unsigned long end) | 481 | void free_initrd_mem(unsigned long start, unsigned long end) |
507 | { | 482 | { |
508 | free_reserved_area(start, end, 0, "initrd"); | 483 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
509 | } | 484 | } |
510 | #endif | 485 | #endif |
511 | 486 | ||
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 6cfc1b09ec25..d7aa524b7283 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -254,15 +254,12 @@ void __init leon_smp_done(void) | |||
254 | /* Free unneeded trap tables */ | 254 | /* Free unneeded trap tables */ |
255 | if (!cpu_present(1)) { | 255 | if (!cpu_present(1)) { |
256 | free_reserved_page(virt_to_page(&trapbase_cpu1)); | 256 | free_reserved_page(virt_to_page(&trapbase_cpu1)); |
257 | num_physpages++; | ||
258 | } | 257 | } |
259 | if (!cpu_present(2)) { | 258 | if (!cpu_present(2)) { |
260 | free_reserved_page(virt_to_page(&trapbase_cpu2)); | 259 | free_reserved_page(virt_to_page(&trapbase_cpu2)); |
261 | num_physpages++; | ||
262 | } | 260 | } |
263 | if (!cpu_present(3)) { | 261 | if (!cpu_present(3)) { |
264 | free_reserved_page(virt_to_page(&trapbase_cpu3)); | 262 | free_reserved_page(virt_to_page(&trapbase_cpu3)); |
265 | num_physpages++; | ||
266 | } | 263 | } |
267 | /* Ok, they are spinning and ready to go. */ | 264 | /* Ok, they are spinning and ready to go. */ |
268 | smp_processors_ready = 1; | 265 | smp_processors_ready = 1; |
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index af472cf7c69a..db6987082805 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c | |||
@@ -288,10 +288,6 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn) | |||
288 | 288 | ||
289 | void __init mem_init(void) | 289 | void __init mem_init(void) |
290 | { | 290 | { |
291 | int codepages = 0; | ||
292 | int datapages = 0; | ||
293 | int initpages = 0; | ||
294 | int reservedpages = 0; | ||
295 | int i; | 291 | int i; |
296 | 292 | ||
297 | if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) { | 293 | if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) { |
@@ -323,15 +319,12 @@ void __init mem_init(void) | |||
323 | 319 | ||
324 | max_mapnr = last_valid_pfn - pfn_base; | 320 | max_mapnr = last_valid_pfn - pfn_base; |
325 | high_memory = __va(max_low_pfn << PAGE_SHIFT); | 321 | high_memory = __va(max_low_pfn << PAGE_SHIFT); |
326 | 322 | free_all_bootmem(); | |
327 | totalram_pages = free_all_bootmem(); | ||
328 | 323 | ||
329 | for (i = 0; sp_banks[i].num_bytes != 0; i++) { | 324 | for (i = 0; sp_banks[i].num_bytes != 0; i++) { |
330 | unsigned long start_pfn = sp_banks[i].base_addr >> PAGE_SHIFT; | 325 | unsigned long start_pfn = sp_banks[i].base_addr >> PAGE_SHIFT; |
331 | unsigned long end_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT; | 326 | unsigned long end_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT; |
332 | 327 | ||
333 | num_physpages += sp_banks[i].num_bytes >> PAGE_SHIFT; | ||
334 | |||
335 | if (end_pfn <= highstart_pfn) | 328 | if (end_pfn <= highstart_pfn) |
336 | continue; | 329 | continue; |
337 | 330 | ||
@@ -341,39 +334,19 @@ void __init mem_init(void) | |||
341 | map_high_region(start_pfn, end_pfn); | 334 | map_high_region(start_pfn, end_pfn); |
342 | } | 335 | } |
343 | 336 | ||
344 | codepages = (((unsigned long) &_etext) - ((unsigned long)&_start)); | 337 | mem_init_print_info(NULL); |
345 | codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT; | ||
346 | datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext)); | ||
347 | datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT; | ||
348 | initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin)); | ||
349 | initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT; | ||
350 | |||
351 | /* Ignore memory holes for the purpose of counting reserved pages */ | ||
352 | for (i=0; i < max_low_pfn; i++) | ||
353 | if (test_bit(i >> (20 - PAGE_SHIFT), sparc_valid_addr_bitmap) | ||
354 | && PageReserved(pfn_to_page(i))) | ||
355 | reservedpages++; | ||
356 | |||
357 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", | ||
358 | nr_free_pages() << (PAGE_SHIFT-10), | ||
359 | num_physpages << (PAGE_SHIFT - 10), | ||
360 | codepages << (PAGE_SHIFT-10), | ||
361 | reservedpages << (PAGE_SHIFT - 10), | ||
362 | datapages << (PAGE_SHIFT-10), | ||
363 | initpages << (PAGE_SHIFT-10), | ||
364 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
365 | } | 338 | } |
366 | 339 | ||
367 | void free_initmem (void) | 340 | void free_initmem (void) |
368 | { | 341 | { |
369 | num_physpages += free_initmem_default(POISON_FREE_INITMEM); | 342 | free_initmem_default(POISON_FREE_INITMEM); |
370 | } | 343 | } |
371 | 344 | ||
372 | #ifdef CONFIG_BLK_DEV_INITRD | 345 | #ifdef CONFIG_BLK_DEV_INITRD |
373 | void free_initrd_mem(unsigned long start, unsigned long end) | 346 | void free_initrd_mem(unsigned long start, unsigned long end) |
374 | { | 347 | { |
375 | num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, | 348 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
376 | "initrd"); | 349 | "initrd"); |
377 | } | 350 | } |
378 | #endif | 351 | #endif |
379 | 352 | ||
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 04fd55a6e461..a9c42a7ffb6a 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -2045,7 +2045,6 @@ static void __init register_page_bootmem_info(void) | |||
2045 | } | 2045 | } |
2046 | void __init mem_init(void) | 2046 | void __init mem_init(void) |
2047 | { | 2047 | { |
2048 | unsigned long codepages, datapages, initpages; | ||
2049 | unsigned long addr, last; | 2048 | unsigned long addr, last; |
2050 | 2049 | ||
2051 | addr = PAGE_OFFSET + kern_base; | 2050 | addr = PAGE_OFFSET + kern_base; |
@@ -2061,12 +2060,7 @@ void __init mem_init(void) | |||
2061 | high_memory = __va(last_valid_pfn << PAGE_SHIFT); | 2060 | high_memory = __va(last_valid_pfn << PAGE_SHIFT); |
2062 | 2061 | ||
2063 | register_page_bootmem_info(); | 2062 | register_page_bootmem_info(); |
2064 | totalram_pages = free_all_bootmem(); | 2063 | free_all_bootmem(); |
2065 | |||
2066 | /* We subtract one to account for the mem_map_zero page | ||
2067 | * allocated below. | ||
2068 | */ | ||
2069 | num_physpages = totalram_pages - 1; | ||
2070 | 2064 | ||
2071 | /* | 2065 | /* |
2072 | * Set up the zero page, mark it reserved, so that page count | 2066 | * Set up the zero page, mark it reserved, so that page count |
@@ -2079,19 +2073,7 @@ void __init mem_init(void) | |||
2079 | } | 2073 | } |
2080 | mark_page_reserved(mem_map_zero); | 2074 | mark_page_reserved(mem_map_zero); |
2081 | 2075 | ||
2082 | codepages = (((unsigned long) _etext) - ((unsigned long) _start)); | 2076 | mem_init_print_info(NULL); |
2083 | codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT; | ||
2084 | datapages = (((unsigned long) _edata) - ((unsigned long) _etext)); | ||
2085 | datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT; | ||
2086 | initpages = (((unsigned long) __init_end) - ((unsigned long) __init_begin)); | ||
2087 | initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT; | ||
2088 | |||
2089 | printk("Memory: %luk available (%ldk kernel code, %ldk data, %ldk init) [%016lx,%016lx]\n", | ||
2090 | nr_free_pages() << (PAGE_SHIFT-10), | ||
2091 | codepages << (PAGE_SHIFT-10), | ||
2092 | datapages << (PAGE_SHIFT-10), | ||
2093 | initpages << (PAGE_SHIFT-10), | ||
2094 | PAGE_OFFSET, (last_valid_pfn << PAGE_SHIFT)); | ||
2095 | 2077 | ||
2096 | if (tlb_type == cheetah || tlb_type == cheetah_plus) | 2078 | if (tlb_type == cheetah || tlb_type == cheetah_plus) |
2097 | cheetah_ecache_flush_init(); | 2079 | cheetah_ecache_flush_init(); |
@@ -2131,8 +2113,8 @@ void free_initmem(void) | |||
2131 | #ifdef CONFIG_BLK_DEV_INITRD | 2113 | #ifdef CONFIG_BLK_DEV_INITRD |
2132 | void free_initrd_mem(unsigned long start, unsigned long end) | 2114 | void free_initrd_mem(unsigned long start, unsigned long end) |
2133 | { | 2115 | { |
2134 | num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, | 2116 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
2135 | "initrd"); | 2117 | "initrd"); |
2136 | } | 2118 | } |
2137 | #endif | 2119 | #endif |
2138 | 2120 | ||
diff --git a/arch/tile/include/asm/sections.h b/arch/tile/include/asm/sections.h index d062d463fca9..7d8a935a9238 100644 --- a/arch/tile/include/asm/sections.h +++ b/arch/tile/include/asm/sections.h | |||
@@ -34,7 +34,7 @@ extern char __sys_cmpxchg_grab_lock[]; | |||
34 | extern char __start_atomic_asm_code[], __end_atomic_asm_code[]; | 34 | extern char __start_atomic_asm_code[], __end_atomic_asm_code[]; |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | /* Handle the discontiguity between _sdata and _stext. */ | 37 | /* Handle the discontiguity between _sdata and _text. */ |
38 | static inline int arch_is_kernel_data(unsigned long addr) | 38 | static inline int arch_is_kernel_data(unsigned long addr) |
39 | { | 39 | { |
40 | return addr >= (unsigned long)_sdata && | 40 | return addr >= (unsigned long)_sdata && |
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 7a5aa1a7864e..68b542677f6a 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -307,8 +307,8 @@ static void __cpuinit store_permanent_mappings(void) | |||
307 | hv_store_mapping(addr, pages << PAGE_SHIFT, pa); | 307 | hv_store_mapping(addr, pages << PAGE_SHIFT, pa); |
308 | } | 308 | } |
309 | 309 | ||
310 | hv_store_mapping((HV_VirtAddr)_stext, | 310 | hv_store_mapping((HV_VirtAddr)_text, |
311 | (uint32_t)(_einittext - _stext), 0); | 311 | (uint32_t)(_einittext - _text), 0); |
312 | } | 312 | } |
313 | 313 | ||
314 | /* | 314 | /* |
@@ -329,6 +329,7 @@ static void __init setup_memory(void) | |||
329 | #if defined(CONFIG_HIGHMEM) || defined(__tilegx__) | 329 | #if defined(CONFIG_HIGHMEM) || defined(__tilegx__) |
330 | long lowmem_pages; | 330 | long lowmem_pages; |
331 | #endif | 331 | #endif |
332 | unsigned long physpages = 0; | ||
332 | 333 | ||
333 | /* We are using a char to hold the cpu_2_node[] mapping */ | 334 | /* We are using a char to hold the cpu_2_node[] mapping */ |
334 | BUILD_BUG_ON(MAX_NUMNODES > 127); | 335 | BUILD_BUG_ON(MAX_NUMNODES > 127); |
@@ -388,8 +389,8 @@ static void __init setup_memory(void) | |||
388 | continue; | 389 | continue; |
389 | } | 390 | } |
390 | } | 391 | } |
391 | if (num_physpages + PFN_DOWN(range.size) > maxmem_pfn) { | 392 | if (physpages + PFN_DOWN(range.size) > maxmem_pfn) { |
392 | int max_size = maxmem_pfn - num_physpages; | 393 | int max_size = maxmem_pfn - physpages; |
393 | if (max_size > 0) { | 394 | if (max_size > 0) { |
394 | pr_err("Maxmem reduced node %d to %d pages\n", | 395 | pr_err("Maxmem reduced node %d to %d pages\n", |
395 | i, max_size); | 396 | i, max_size); |
@@ -446,7 +447,7 @@ static void __init setup_memory(void) | |||
446 | node_start_pfn[i] = start; | 447 | node_start_pfn[i] = start; |
447 | node_end_pfn[i] = end; | 448 | node_end_pfn[i] = end; |
448 | node_controller[i] = range.controller; | 449 | node_controller[i] = range.controller; |
449 | num_physpages += size; | 450 | physpages += size; |
450 | max_pfn = end; | 451 | max_pfn = end; |
451 | 452 | ||
452 | /* Mark node as online */ | 453 | /* Mark node as online */ |
@@ -465,7 +466,7 @@ static void __init setup_memory(void) | |||
465 | * we're willing to use at 8 million pages (32GB of 4KB pages). | 466 | * we're willing to use at 8 million pages (32GB of 4KB pages). |
466 | */ | 467 | */ |
467 | cap = 8 * 1024 * 1024; /* 8 million pages */ | 468 | cap = 8 * 1024 * 1024; /* 8 million pages */ |
468 | if (num_physpages > cap) { | 469 | if (physpages > cap) { |
469 | int num_nodes = num_online_nodes(); | 470 | int num_nodes = num_online_nodes(); |
470 | int cap_each = cap / num_nodes; | 471 | int cap_each = cap / num_nodes; |
471 | unsigned long dropped_pages = 0; | 472 | unsigned long dropped_pages = 0; |
@@ -476,10 +477,10 @@ static void __init setup_memory(void) | |||
476 | node_end_pfn[i] = node_start_pfn[i] + cap_each; | 477 | node_end_pfn[i] = node_start_pfn[i] + cap_each; |
477 | } | 478 | } |
478 | } | 479 | } |
479 | num_physpages -= dropped_pages; | 480 | physpages -= dropped_pages; |
480 | pr_warning("Only using %ldMB memory;" | 481 | pr_warning("Only using %ldMB memory;" |
481 | " ignoring %ldMB.\n", | 482 | " ignoring %ldMB.\n", |
482 | num_physpages >> (20 - PAGE_SHIFT), | 483 | physpages >> (20 - PAGE_SHIFT), |
483 | dropped_pages >> (20 - PAGE_SHIFT)); | 484 | dropped_pages >> (20 - PAGE_SHIFT)); |
484 | pr_warning("Consider using a larger page size.\n"); | 485 | pr_warning("Consider using a larger page size.\n"); |
485 | } | 486 | } |
@@ -497,7 +498,7 @@ static void __init setup_memory(void) | |||
497 | 498 | ||
498 | lowmem_pages = (mappable_physpages > MAXMEM_PFN) ? | 499 | lowmem_pages = (mappable_physpages > MAXMEM_PFN) ? |
499 | MAXMEM_PFN : mappable_physpages; | 500 | MAXMEM_PFN : mappable_physpages; |
500 | highmem_pages = (long) (num_physpages - lowmem_pages); | 501 | highmem_pages = (long) (physpages - lowmem_pages); |
501 | 502 | ||
502 | pr_notice("%ldMB HIGHMEM available.\n", | 503 | pr_notice("%ldMB HIGHMEM available.\n", |
503 | pages_to_mb(highmem_pages > 0 ? highmem_pages : 0)); | 504 | pages_to_mb(highmem_pages > 0 ? highmem_pages : 0)); |
@@ -514,7 +515,6 @@ static void __init setup_memory(void) | |||
514 | pr_warning("Use a HIGHMEM enabled kernel.\n"); | 515 | pr_warning("Use a HIGHMEM enabled kernel.\n"); |
515 | max_low_pfn = MAXMEM_PFN; | 516 | max_low_pfn = MAXMEM_PFN; |
516 | max_pfn = MAXMEM_PFN; | 517 | max_pfn = MAXMEM_PFN; |
517 | num_physpages = MAXMEM_PFN; | ||
518 | node_end_pfn[0] = MAXMEM_PFN; | 518 | node_end_pfn[0] = MAXMEM_PFN; |
519 | } else { | 519 | } else { |
520 | pr_notice("%ldMB memory available.\n", | 520 | pr_notice("%ldMB memory available.\n", |
diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S index 631f10de12fe..a13ed902afbb 100644 --- a/arch/tile/kernel/vmlinux.lds.S +++ b/arch/tile/kernel/vmlinux.lds.S | |||
@@ -27,7 +27,6 @@ SECTIONS | |||
27 | .intrpt1 (LOAD_OFFSET) : AT ( 0 ) /* put at the start of physical memory */ | 27 | .intrpt1 (LOAD_OFFSET) : AT ( 0 ) /* put at the start of physical memory */ |
28 | { | 28 | { |
29 | _text = .; | 29 | _text = .; |
30 | _stext = .; | ||
31 | *(.intrpt1) | 30 | *(.intrpt1) |
32 | } :intrpt1 =0 | 31 | } :intrpt1 =0 |
33 | 32 | ||
@@ -36,6 +35,7 @@ SECTIONS | |||
36 | 35 | ||
37 | /* Now the real code */ | 36 | /* Now the real code */ |
38 | . = ALIGN(0x20000); | 37 | . = ALIGN(0x20000); |
38 | _stext = .; | ||
39 | .text : AT (ADDR(.text) - LOAD_OFFSET) { | 39 | .text : AT (ADDR(.text) - LOAD_OFFSET) { |
40 | HEAD_TEXT | 40 | HEAD_TEXT |
41 | SCHED_TEXT | 41 | SCHED_TEXT |
@@ -58,11 +58,13 @@ SECTIONS | |||
58 | #define LOAD_OFFSET PAGE_OFFSET | 58 | #define LOAD_OFFSET PAGE_OFFSET |
59 | 59 | ||
60 | . = ALIGN(PAGE_SIZE); | 60 | . = ALIGN(PAGE_SIZE); |
61 | __init_begin = .; | ||
61 | VMLINUX_SYMBOL(_sinitdata) = .; | 62 | VMLINUX_SYMBOL(_sinitdata) = .; |
62 | INIT_DATA_SECTION(16) :data =0 | 63 | INIT_DATA_SECTION(16) :data =0 |
63 | PERCPU_SECTION(L2_CACHE_BYTES) | 64 | PERCPU_SECTION(L2_CACHE_BYTES) |
64 | . = ALIGN(PAGE_SIZE); | 65 | . = ALIGN(PAGE_SIZE); |
65 | VMLINUX_SYMBOL(_einitdata) = .; | 66 | VMLINUX_SYMBOL(_einitdata) = .; |
67 | __init_end = .; | ||
66 | 68 | ||
67 | _sdata = .; /* Start of data section */ | 69 | _sdata = .; /* Start of data section */ |
68 | 70 | ||
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c index 2749515a0547..e182958c707d 100644 --- a/arch/tile/mm/init.c +++ b/arch/tile/mm/init.c | |||
@@ -562,7 +562,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) | |||
562 | prot = ktext_set_nocache(prot); | 562 | prot = ktext_set_nocache(prot); |
563 | } | 563 | } |
564 | 564 | ||
565 | BUG_ON(address != (unsigned long)_stext); | 565 | BUG_ON(address != (unsigned long)_text); |
566 | pte = NULL; | 566 | pte = NULL; |
567 | for (; address < (unsigned long)_einittext; | 567 | for (; address < (unsigned long)_einittext; |
568 | pfn++, address += PAGE_SIZE) { | 568 | pfn++, address += PAGE_SIZE) { |
@@ -720,7 +720,7 @@ static void __init init_free_pfn_range(unsigned long start, unsigned long end) | |||
720 | } | 720 | } |
721 | init_page_count(page); | 721 | init_page_count(page); |
722 | __free_pages(page, order); | 722 | __free_pages(page, order); |
723 | totalram_pages += count; | 723 | adjust_managed_page_count(page, count); |
724 | 724 | ||
725 | page += count; | 725 | page += count; |
726 | pfn += count; | 726 | pfn += count; |
@@ -821,7 +821,6 @@ static void __init set_max_mapnr_init(void) | |||
821 | 821 | ||
822 | void __init mem_init(void) | 822 | void __init mem_init(void) |
823 | { | 823 | { |
824 | int codesize, datasize, initsize; | ||
825 | int i; | 824 | int i; |
826 | #ifndef __tilegx__ | 825 | #ifndef __tilegx__ |
827 | void *last; | 826 | void *last; |
@@ -846,26 +845,14 @@ void __init mem_init(void) | |||
846 | set_max_mapnr_init(); | 845 | set_max_mapnr_init(); |
847 | 846 | ||
848 | /* this will put all bootmem onto the freelists */ | 847 | /* this will put all bootmem onto the freelists */ |
849 | totalram_pages += free_all_bootmem(); | 848 | free_all_bootmem(); |
850 | 849 | ||
851 | #ifndef CONFIG_64BIT | 850 | #ifndef CONFIG_64BIT |
852 | /* count all remaining LOWMEM and give all HIGHMEM to page allocator */ | 851 | /* count all remaining LOWMEM and give all HIGHMEM to page allocator */ |
853 | set_non_bootmem_pages_init(); | 852 | set_non_bootmem_pages_init(); |
854 | #endif | 853 | #endif |
855 | 854 | ||
856 | codesize = (unsigned long)&_etext - (unsigned long)&_text; | 855 | mem_init_print_info(NULL); |
857 | datasize = (unsigned long)&_end - (unsigned long)&_sdata; | ||
858 | initsize = (unsigned long)&_einittext - (unsigned long)&_sinittext; | ||
859 | initsize += (unsigned long)&_einitdata - (unsigned long)&_sinitdata; | ||
860 | |||
861 | pr_info("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init, %ldk highmem)\n", | ||
862 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | ||
863 | num_physpages << (PAGE_SHIFT-10), | ||
864 | codesize >> 10, | ||
865 | datasize >> 10, | ||
866 | initsize >> 10, | ||
867 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) | ||
868 | ); | ||
869 | 856 | ||
870 | /* | 857 | /* |
871 | * In debug mode, dump some interesting memory mappings. | 858 | * In debug mode, dump some interesting memory mappings. |
@@ -1024,16 +1011,13 @@ static void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
1024 | pte_clear(&init_mm, addr, ptep); | 1011 | pte_clear(&init_mm, addr, ptep); |
1025 | continue; | 1012 | continue; |
1026 | } | 1013 | } |
1027 | __ClearPageReserved(page); | ||
1028 | init_page_count(page); | ||
1029 | if (pte_huge(*ptep)) | 1014 | if (pte_huge(*ptep)) |
1030 | BUG_ON(!kdata_huge); | 1015 | BUG_ON(!kdata_huge); |
1031 | else | 1016 | else |
1032 | set_pte_at(&init_mm, addr, ptep, | 1017 | set_pte_at(&init_mm, addr, ptep, |
1033 | pfn_pte(pfn, PAGE_KERNEL)); | 1018 | pfn_pte(pfn, PAGE_KERNEL)); |
1034 | memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); | 1019 | memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); |
1035 | free_page(addr); | 1020 | free_reserved_page(page); |
1036 | totalram_pages++; | ||
1037 | } | 1021 | } |
1038 | pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10); | 1022 | pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10); |
1039 | } | 1023 | } |
diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S index 4938de5512d2..1dd5bd8a8c59 100644 --- a/arch/um/include/asm/common.lds.S +++ b/arch/um/include/asm/common.lds.S | |||
@@ -57,7 +57,6 @@ | |||
57 | *(.uml.initcall.init) | 57 | *(.uml.initcall.init) |
58 | __uml_initcall_end = .; | 58 | __uml_initcall_end = .; |
59 | } | 59 | } |
60 | __init_end = .; | ||
61 | 60 | ||
62 | SECURITY_INIT | 61 | SECURITY_INIT |
63 | 62 | ||
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S index fb8fd6fb6563..adde088aeeff 100644 --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S | |||
@@ -14,8 +14,6 @@ SECTIONS | |||
14 | __binary_start = .; | 14 | __binary_start = .; |
15 | . = ALIGN(4096); /* Init code and data */ | 15 | . = ALIGN(4096); /* Init code and data */ |
16 | _text = .; | 16 | _text = .; |
17 | _stext = .; | ||
18 | __init_begin = .; | ||
19 | INIT_TEXT_SECTION(PAGE_SIZE) | 17 | INIT_TEXT_SECTION(PAGE_SIZE) |
20 | 18 | ||
21 | . = ALIGN(PAGE_SIZE); | 19 | . = ALIGN(PAGE_SIZE); |
@@ -67,6 +65,7 @@ SECTIONS | |||
67 | } =0x90909090 | 65 | } =0x90909090 |
68 | .plt : { *(.plt) } | 66 | .plt : { *(.plt) } |
69 | .text : { | 67 | .text : { |
68 | _stext = .; | ||
70 | TEXT_TEXT | 69 | TEXT_TEXT |
71 | SCHED_TEXT | 70 | SCHED_TEXT |
72 | LOCK_TEXT | 71 | LOCK_TEXT |
@@ -91,7 +90,9 @@ SECTIONS | |||
91 | 90 | ||
92 | #include <asm/common.lds.S> | 91 | #include <asm/common.lds.S> |
93 | 92 | ||
93 | __init_begin = .; | ||
94 | init.data : { INIT_DATA } | 94 | init.data : { INIT_DATA } |
95 | __init_end = .; | ||
95 | 96 | ||
96 | /* Ensure the __preinit_array_start label is properly aligned. We | 97 | /* Ensure the __preinit_array_start label is properly aligned. We |
97 | could instead move the label definition inside the section, but | 98 | could instead move the label definition inside the section, but |
@@ -155,6 +156,7 @@ SECTIONS | |||
155 | . = ALIGN(32 / 8); | 156 | . = ALIGN(32 / 8); |
156 | . = ALIGN(32 / 8); | 157 | . = ALIGN(32 / 8); |
157 | } | 158 | } |
159 | __bss_stop = .; | ||
158 | _end = .; | 160 | _end = .; |
159 | PROVIDE (end = .); | 161 | PROVIDE (end = .); |
160 | 162 | ||
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index 9df292b270a8..7ddb64baf327 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c | |||
@@ -65,15 +65,13 @@ void __init mem_init(void) | |||
65 | uml_reserved = brk_end; | 65 | uml_reserved = brk_end; |
66 | 66 | ||
67 | /* this will put all low memory onto the freelists */ | 67 | /* this will put all low memory onto the freelists */ |
68 | totalram_pages = free_all_bootmem(); | 68 | free_all_bootmem(); |
69 | max_low_pfn = totalram_pages; | 69 | max_low_pfn = totalram_pages; |
70 | #ifdef CONFIG_HIGHMEM | 70 | #ifdef CONFIG_HIGHMEM |
71 | setup_highmem(end_iomem, highmem); | 71 | setup_highmem(end_iomem, highmem); |
72 | #endif | 72 | #endif |
73 | num_physpages = totalram_pages; | ||
74 | max_pfn = totalram_pages; | 73 | max_pfn = totalram_pages; |
75 | printk(KERN_INFO "Memory: %luk available\n", | 74 | mem_init_print_info(NULL); |
76 | nr_free_pages() << (PAGE_SHIFT-10)); | ||
77 | kmalloc_ok = 1; | 75 | kmalloc_ok = 1; |
78 | } | 76 | } |
79 | 77 | ||
@@ -244,7 +242,7 @@ void free_initmem(void) | |||
244 | #ifdef CONFIG_BLK_DEV_INITRD | 242 | #ifdef CONFIG_BLK_DEV_INITRD |
245 | void free_initrd_mem(unsigned long start, unsigned long end) | 243 | void free_initrd_mem(unsigned long start, unsigned long end) |
246 | { | 244 | { |
247 | free_reserved_area(start, end, 0, "initrd"); | 245 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
248 | } | 246 | } |
249 | #endif | 247 | #endif |
250 | 248 | ||
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index ff65fb4f1a95..6899195602b7 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S | |||
@@ -20,13 +20,12 @@ SECTIONS | |||
20 | . = START + SIZEOF_HEADERS; | 20 | . = START + SIZEOF_HEADERS; |
21 | 21 | ||
22 | _text = .; | 22 | _text = .; |
23 | _stext = .; | ||
24 | __init_begin = .; | ||
25 | INIT_TEXT_SECTION(0) | 23 | INIT_TEXT_SECTION(0) |
26 | . = ALIGN(PAGE_SIZE); | 24 | . = ALIGN(PAGE_SIZE); |
27 | 25 | ||
28 | .text : | 26 | .text : |
29 | { | 27 | { |
28 | _stext = .; | ||
30 | TEXT_TEXT | 29 | TEXT_TEXT |
31 | SCHED_TEXT | 30 | SCHED_TEXT |
32 | LOCK_TEXT | 31 | LOCK_TEXT |
@@ -62,7 +61,10 @@ SECTIONS | |||
62 | 61 | ||
63 | #include <asm/common.lds.S> | 62 | #include <asm/common.lds.S> |
64 | 63 | ||
64 | __init_begin = .; | ||
65 | init.data : { INIT_DATA } | 65 | init.data : { INIT_DATA } |
66 | __init_end = .; | ||
67 | |||
66 | .data : | 68 | .data : |
67 | { | 69 | { |
68 | INIT_TASK_DATA(KERNEL_STACK_SIZE) | 70 | INIT_TASK_DATA(KERNEL_STACK_SIZE) |
@@ -97,6 +99,7 @@ SECTIONS | |||
97 | PROVIDE(_bss_start = .); | 99 | PROVIDE(_bss_start = .); |
98 | SBSS(0) | 100 | SBSS(0) |
99 | BSS(0) | 101 | BSS(0) |
102 | __bss_stop = .; | ||
100 | _end = .; | 103 | _end = .; |
101 | PROVIDE (end = .); | 104 | PROVIDE (end = .); |
102 | 105 | ||
diff --git a/arch/unicore32/include/asm/memory.h b/arch/unicore32/include/asm/memory.h index 5eddb997defe..debafc40200a 100644 --- a/arch/unicore32/include/asm/memory.h +++ b/arch/unicore32/include/asm/memory.h | |||
@@ -98,12 +98,6 @@ | |||
98 | /* | 98 | /* |
99 | * Conversion between a struct page and a physical address. | 99 | * Conversion between a struct page and a physical address. |
100 | * | 100 | * |
101 | * Note: when converting an unknown physical address to a | ||
102 | * struct page, the resulting pointer must be validated | ||
103 | * using VALID_PAGE(). It must return an invalid struct page | ||
104 | * for any physical address not corresponding to a system | ||
105 | * RAM address. | ||
106 | * | ||
107 | * page_to_pfn(page) convert a struct page * to a PFN number | 101 | * page_to_pfn(page) convert a struct page * to a PFN number |
108 | * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * | 102 | * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * |
109 | * | 103 | * |
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c index 63df12d71ce3..ae6bc036db92 100644 --- a/arch/unicore32/mm/init.c +++ b/arch/unicore32/mm/init.c | |||
@@ -383,59 +383,14 @@ static void __init free_unused_memmap(struct meminfo *mi) | |||
383 | */ | 383 | */ |
384 | void __init mem_init(void) | 384 | void __init mem_init(void) |
385 | { | 385 | { |
386 | unsigned long reserved_pages, free_pages; | ||
387 | struct memblock_region *reg; | ||
388 | int i; | ||
389 | |||
390 | max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; | 386 | max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; |
391 | 387 | ||
392 | free_unused_memmap(&meminfo); | 388 | free_unused_memmap(&meminfo); |
393 | 389 | ||
394 | /* this will put all unused low memory onto the freelists */ | 390 | /* this will put all unused low memory onto the freelists */ |
395 | totalram_pages += free_all_bootmem(); | 391 | free_all_bootmem(); |
396 | |||
397 | reserved_pages = free_pages = 0; | ||
398 | |||
399 | for_each_bank(i, &meminfo) { | ||
400 | struct membank *bank = &meminfo.bank[i]; | ||
401 | unsigned int pfn1, pfn2; | ||
402 | struct page *page, *end; | ||
403 | |||
404 | pfn1 = bank_pfn_start(bank); | ||
405 | pfn2 = bank_pfn_end(bank); | ||
406 | |||
407 | page = pfn_to_page(pfn1); | ||
408 | end = pfn_to_page(pfn2 - 1) + 1; | ||
409 | |||
410 | do { | ||
411 | if (PageReserved(page)) | ||
412 | reserved_pages++; | ||
413 | else if (!page_count(page)) | ||
414 | free_pages++; | ||
415 | page++; | ||
416 | } while (page < end); | ||
417 | } | ||
418 | |||
419 | /* | ||
420 | * Since our memory may not be contiguous, calculate the | ||
421 | * real number of pages we have in this system | ||
422 | */ | ||
423 | printk(KERN_INFO "Memory:"); | ||
424 | num_physpages = 0; | ||
425 | for_each_memblock(memory, reg) { | ||
426 | unsigned long pages = memblock_region_memory_end_pfn(reg) - | ||
427 | memblock_region_memory_base_pfn(reg); | ||
428 | num_physpages += pages; | ||
429 | printk(" %ldMB", pages >> (20 - PAGE_SHIFT)); | ||
430 | } | ||
431 | printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); | ||
432 | |||
433 | printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n", | ||
434 | nr_free_pages() << (PAGE_SHIFT-10), | ||
435 | free_pages << (PAGE_SHIFT-10), | ||
436 | reserved_pages << (PAGE_SHIFT-10), | ||
437 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
438 | 392 | ||
393 | mem_init_print_info(NULL); | ||
439 | printk(KERN_NOTICE "Virtual kernel memory layout:\n" | 394 | printk(KERN_NOTICE "Virtual kernel memory layout:\n" |
440 | " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" | 395 | " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" |
441 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" | 396 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" |
@@ -464,7 +419,7 @@ void __init mem_init(void) | |||
464 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); | 419 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); |
465 | BUG_ON(TASK_SIZE > MODULES_VADDR); | 420 | BUG_ON(TASK_SIZE > MODULES_VADDR); |
466 | 421 | ||
467 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | 422 | if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) { |
468 | /* | 423 | /* |
469 | * On a machine this small we won't get | 424 | * On a machine this small we won't get |
470 | * anywhere without overcommit, so turn | 425 | * anywhere without overcommit, so turn |
@@ -476,7 +431,7 @@ void __init mem_init(void) | |||
476 | 431 | ||
477 | void free_initmem(void) | 432 | void free_initmem(void) |
478 | { | 433 | { |
479 | free_initmem_default(0); | 434 | free_initmem_default(-1); |
480 | } | 435 | } |
481 | 436 | ||
482 | #ifdef CONFIG_BLK_DEV_INITRD | 437 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -486,7 +441,7 @@ static int keep_initrd; | |||
486 | void free_initrd_mem(unsigned long start, unsigned long end) | 441 | void free_initrd_mem(unsigned long start, unsigned long end) |
487 | { | 442 | { |
488 | if (!keep_initrd) | 443 | if (!keep_initrd) |
489 | free_reserved_area(start, end, 0, "initrd"); | 444 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
490 | } | 445 | } |
491 | 446 | ||
492 | static int __init keepinitrd_setup(char *__unused) | 447 | static int __init keepinitrd_setup(char *__unused) |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index b094816a7e0f..2775023a0744 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -102,6 +102,7 @@ config X86 | |||
102 | select HAVE_ARCH_SECCOMP_FILTER | 102 | select HAVE_ARCH_SECCOMP_FILTER |
103 | select BUILDTIME_EXTABLE_SORT | 103 | select BUILDTIME_EXTABLE_SORT |
104 | select GENERIC_CMOS_UPDATE | 104 | select GENERIC_CMOS_UPDATE |
105 | select HAVE_ARCH_SOFT_DIRTY | ||
105 | select CLOCKSOURCE_WATCHDOG | 106 | select CLOCKSOURCE_WATCHDOG |
106 | select GENERIC_CLOCKEVENTS | 107 | select GENERIC_CLOCKEVENTS |
107 | select ARCH_CLOCKSOURCE_DATA if X86_64 | 108 | select ARCH_CLOCKSOURCE_DATA if X86_64 |
@@ -2258,11 +2259,11 @@ source "drivers/pcmcia/Kconfig" | |||
2258 | source "drivers/pci/hotplug/Kconfig" | 2259 | source "drivers/pci/hotplug/Kconfig" |
2259 | 2260 | ||
2260 | config RAPIDIO | 2261 | config RAPIDIO |
2261 | bool "RapidIO support" | 2262 | tristate "RapidIO support" |
2262 | depends on PCI | 2263 | depends on PCI |
2263 | default n | 2264 | default n |
2264 | help | 2265 | help |
2265 | If you say Y here, the kernel will include drivers and | 2266 | If enabled this option will include drivers and the core |
2266 | infrastructure code to support RapidIO interconnect devices. | 2267 | infrastructure code to support RapidIO interconnect devices. |
2267 | 2268 | ||
2268 | source "drivers/rapidio/Kconfig" | 2269 | source "drivers/rapidio/Kconfig" |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 5b0818bc8963..7dc305a46058 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -207,7 +207,7 @@ static inline pte_t pte_mkexec(pte_t pte) | |||
207 | 207 | ||
208 | static inline pte_t pte_mkdirty(pte_t pte) | 208 | static inline pte_t pte_mkdirty(pte_t pte) |
209 | { | 209 | { |
210 | return pte_set_flags(pte, _PAGE_DIRTY); | 210 | return pte_set_flags(pte, _PAGE_DIRTY | _PAGE_SOFT_DIRTY); |
211 | } | 211 | } |
212 | 212 | ||
213 | static inline pte_t pte_mkyoung(pte_t pte) | 213 | static inline pte_t pte_mkyoung(pte_t pte) |
@@ -271,7 +271,7 @@ static inline pmd_t pmd_wrprotect(pmd_t pmd) | |||
271 | 271 | ||
272 | static inline pmd_t pmd_mkdirty(pmd_t pmd) | 272 | static inline pmd_t pmd_mkdirty(pmd_t pmd) |
273 | { | 273 | { |
274 | return pmd_set_flags(pmd, _PAGE_DIRTY); | 274 | return pmd_set_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY); |
275 | } | 275 | } |
276 | 276 | ||
277 | static inline pmd_t pmd_mkhuge(pmd_t pmd) | 277 | static inline pmd_t pmd_mkhuge(pmd_t pmd) |
@@ -294,6 +294,26 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd) | |||
294 | return pmd_clear_flags(pmd, _PAGE_PRESENT); | 294 | return pmd_clear_flags(pmd, _PAGE_PRESENT); |
295 | } | 295 | } |
296 | 296 | ||
297 | static inline int pte_soft_dirty(pte_t pte) | ||
298 | { | ||
299 | return pte_flags(pte) & _PAGE_SOFT_DIRTY; | ||
300 | } | ||
301 | |||
302 | static inline int pmd_soft_dirty(pmd_t pmd) | ||
303 | { | ||
304 | return pmd_flags(pmd) & _PAGE_SOFT_DIRTY; | ||
305 | } | ||
306 | |||
307 | static inline pte_t pte_mksoft_dirty(pte_t pte) | ||
308 | { | ||
309 | return pte_set_flags(pte, _PAGE_SOFT_DIRTY); | ||
310 | } | ||
311 | |||
312 | static inline pmd_t pmd_mksoft_dirty(pmd_t pmd) | ||
313 | { | ||
314 | return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY); | ||
315 | } | ||
316 | |||
297 | /* | 317 | /* |
298 | * Mask out unsupported bits in a present pgprot. Non-present pgprots | 318 | * Mask out unsupported bits in a present pgprot. Non-present pgprots |
299 | * can use those bits for other purposes, so leave them be. | 319 | * can use those bits for other purposes, so leave them be. |
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index e6423002c10b..c98ac63aae48 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h | |||
@@ -55,6 +55,18 @@ | |||
55 | #define _PAGE_HIDDEN (_AT(pteval_t, 0)) | 55 | #define _PAGE_HIDDEN (_AT(pteval_t, 0)) |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | /* | ||
59 | * The same hidden bit is used by kmemcheck, but since kmemcheck | ||
60 | * works on kernel pages while soft-dirty engine on user space, | ||
61 | * they do not conflict with each other. | ||
62 | */ | ||
63 | |||
64 | #ifdef CONFIG_MEM_SOFT_DIRTY | ||
65 | #define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN) | ||
66 | #else | ||
67 | #define _PAGE_SOFT_DIRTY (_AT(pteval_t, 0)) | ||
68 | #endif | ||
69 | |||
58 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) | 70 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) |
59 | #define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) | 71 | #define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) |
60 | #else | 72 | #else |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index a1df6e84691f..27811190cbd7 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -89,7 +89,6 @@ struct thread_info { | |||
89 | #define TIF_FORK 18 /* ret_from_fork */ | 89 | #define TIF_FORK 18 /* ret_from_fork */ |
90 | #define TIF_NOHZ 19 /* in adaptive nohz mode */ | 90 | #define TIF_NOHZ 19 /* in adaptive nohz mode */ |
91 | #define TIF_MEMDIE 20 /* is terminating due to OOM killer */ | 91 | #define TIF_MEMDIE 20 /* is terminating due to OOM killer */ |
92 | #define TIF_DEBUG 21 /* uses debug registers */ | ||
93 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ | 92 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ |
94 | #define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ | 93 | #define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ |
95 | #define TIF_BLOCKSTEP 25 /* set when we want DEBUGCTLMSR_BTF */ | 94 | #define TIF_BLOCKSTEP 25 /* set when we want DEBUGCTLMSR_BTF */ |
@@ -113,7 +112,6 @@ struct thread_info { | |||
113 | #define _TIF_IA32 (1 << TIF_IA32) | 112 | #define _TIF_IA32 (1 << TIF_IA32) |
114 | #define _TIF_FORK (1 << TIF_FORK) | 113 | #define _TIF_FORK (1 << TIF_FORK) |
115 | #define _TIF_NOHZ (1 << TIF_NOHZ) | 114 | #define _TIF_NOHZ (1 << TIF_NOHZ) |
116 | #define _TIF_DEBUG (1 << TIF_DEBUG) | ||
117 | #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) | 115 | #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) |
118 | #define _TIF_FORCED_TF (1 << TIF_FORCED_TF) | 116 | #define _TIF_FORCED_TF (1 << TIF_FORCED_TF) |
119 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) | 117 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) |
@@ -154,7 +152,7 @@ struct thread_info { | |||
154 | (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP) | 152 | (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP) |
155 | 153 | ||
156 | #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) | 154 | #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) |
157 | #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) | 155 | #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW) |
158 | 156 | ||
159 | #define PREEMPT_ACTIVE 0x10000000 | 157 | #define PREEMPT_ACTIVE 0x10000000 |
160 | 158 | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 5013a48d1aff..c587a8757227 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -90,7 +90,7 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c) | |||
90 | static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) | 90 | static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) |
91 | { | 91 | { |
92 | u32 l, h; | 92 | u32 l, h; |
93 | int mbytes = num_physpages >> (20-PAGE_SHIFT); | 93 | int mbytes = get_num_physpages() >> (20-PAGE_SHIFT); |
94 | 94 | ||
95 | if (c->x86_model < 6) { | 95 | if (c->x86_model < 6) { |
96 | /* Based on AMD doc 20734R - June 2000 */ | 96 | /* Based on AMD doc 20734R - June 2000 */ |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 56f7fcfe7fa2..e68709da8251 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1040,8 +1040,6 @@ void __init setup_arch(char **cmdline_p) | |||
1040 | /* max_low_pfn get updated here */ | 1040 | /* max_low_pfn get updated here */ |
1041 | find_low_pfn_range(); | 1041 | find_low_pfn_range(); |
1042 | #else | 1042 | #else |
1043 | num_physpages = max_pfn; | ||
1044 | |||
1045 | check_x2apic(); | 1043 | check_x2apic(); |
1046 | 1044 | ||
1047 | /* How many end-of-memory variables you have, grandma! */ | 1045 | /* How many end-of-memory variables you have, grandma! */ |
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c index 252b8f5489ba..4500142bc4aa 100644 --- a/arch/x86/mm/highmem_32.c +++ b/arch/x86/mm/highmem_32.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/highmem.h> | 1 | #include <linux/highmem.h> |
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/swap.h> /* for totalram_pages */ | 3 | #include <linux/swap.h> /* for totalram_pages */ |
4 | #include <linux/bootmem.h> | ||
4 | 5 | ||
5 | void *kmap(struct page *page) | 6 | void *kmap(struct page *page) |
6 | { | 7 | { |
@@ -121,6 +122,11 @@ void __init set_highmem_pages_init(void) | |||
121 | struct zone *zone; | 122 | struct zone *zone; |
122 | int nid; | 123 | int nid; |
123 | 124 | ||
125 | /* | ||
126 | * Explicitly reset zone->managed_pages because set_highmem_pages_init() | ||
127 | * is invoked before free_all_bootmem() | ||
128 | */ | ||
129 | reset_all_zones_managed_pages(); | ||
124 | for_each_zone(zone) { | 130 | for_each_zone(zone) { |
125 | unsigned long zone_start_pfn, zone_end_pfn; | 131 | unsigned long zone_start_pfn, zone_end_pfn; |
126 | 132 | ||
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 1f34e9219775..2ec29ac78ae6 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -494,7 +494,6 @@ int devmem_is_allowed(unsigned long pagenr) | |||
494 | 494 | ||
495 | void free_init_pages(char *what, unsigned long begin, unsigned long end) | 495 | void free_init_pages(char *what, unsigned long begin, unsigned long end) |
496 | { | 496 | { |
497 | unsigned long addr; | ||
498 | unsigned long begin_aligned, end_aligned; | 497 | unsigned long begin_aligned, end_aligned; |
499 | 498 | ||
500 | /* Make sure boundaries are page aligned */ | 499 | /* Make sure boundaries are page aligned */ |
@@ -509,8 +508,6 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
509 | if (begin >= end) | 508 | if (begin >= end) |
510 | return; | 509 | return; |
511 | 510 | ||
512 | addr = begin; | ||
513 | |||
514 | /* | 511 | /* |
515 | * If debugging page accesses then do not free this memory but | 512 | * If debugging page accesses then do not free this memory but |
516 | * mark them not present - any buggy init-section access will | 513 | * mark them not present - any buggy init-section access will |
@@ -529,18 +526,13 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
529 | set_memory_nx(begin, (end - begin) >> PAGE_SHIFT); | 526 | set_memory_nx(begin, (end - begin) >> PAGE_SHIFT); |
530 | set_memory_rw(begin, (end - begin) >> PAGE_SHIFT); | 527 | set_memory_rw(begin, (end - begin) >> PAGE_SHIFT); |
531 | 528 | ||
532 | printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); | 529 | free_reserved_area((void *)begin, (void *)end, POISON_FREE_INITMEM, what); |
533 | |||
534 | for (; addr < end; addr += PAGE_SIZE) { | ||
535 | memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); | ||
536 | free_reserved_page(virt_to_page(addr)); | ||
537 | } | ||
538 | #endif | 530 | #endif |
539 | } | 531 | } |
540 | 532 | ||
541 | void free_initmem(void) | 533 | void free_initmem(void) |
542 | { | 534 | { |
543 | free_init_pages("unused kernel memory", | 535 | free_init_pages("unused kernel", |
544 | (unsigned long)(&__init_begin), | 536 | (unsigned long)(&__init_begin), |
545 | (unsigned long)(&__init_end)); | 537 | (unsigned long)(&__init_end)); |
546 | } | 538 | } |
@@ -566,7 +558,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end) | |||
566 | * - relocate_initrd() | 558 | * - relocate_initrd() |
567 | * So here We can do PAGE_ALIGN() safely to get partial page to be freed | 559 | * So here We can do PAGE_ALIGN() safely to get partial page to be freed |
568 | */ | 560 | */ |
569 | free_init_pages("initrd memory", start, PAGE_ALIGN(end)); | 561 | free_init_pages("initrd", start, PAGE_ALIGN(end)); |
570 | } | 562 | } |
571 | #endif | 563 | #endif |
572 | 564 | ||
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 3ac7e319918d..4287f1ffba7e 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -660,10 +660,8 @@ void __init initmem_init(void) | |||
660 | highstart_pfn = max_low_pfn; | 660 | highstart_pfn = max_low_pfn; |
661 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | 661 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", |
662 | pages_to_mb(highend_pfn - highstart_pfn)); | 662 | pages_to_mb(highend_pfn - highstart_pfn)); |
663 | num_physpages = highend_pfn; | ||
664 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | 663 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; |
665 | #else | 664 | #else |
666 | num_physpages = max_low_pfn; | ||
667 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | 665 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; |
668 | #endif | 666 | #endif |
669 | 667 | ||
@@ -671,7 +669,7 @@ void __init initmem_init(void) | |||
671 | sparse_memory_present_with_active_regions(0); | 669 | sparse_memory_present_with_active_regions(0); |
672 | 670 | ||
673 | #ifdef CONFIG_FLATMEM | 671 | #ifdef CONFIG_FLATMEM |
674 | max_mapnr = num_physpages; | 672 | max_mapnr = IS_ENABLED(CONFIG_HIGHMEM) ? highend_pfn : max_low_pfn; |
675 | #endif | 673 | #endif |
676 | __vmalloc_start_set = true; | 674 | __vmalloc_start_set = true; |
677 | 675 | ||
@@ -739,9 +737,6 @@ static void __init test_wp_bit(void) | |||
739 | 737 | ||
740 | void __init mem_init(void) | 738 | void __init mem_init(void) |
741 | { | 739 | { |
742 | int codesize, reservedpages, datasize, initsize; | ||
743 | int tmp; | ||
744 | |||
745 | pci_iommu_alloc(); | 740 | pci_iommu_alloc(); |
746 | 741 | ||
747 | #ifdef CONFIG_FLATMEM | 742 | #ifdef CONFIG_FLATMEM |
@@ -759,32 +754,11 @@ void __init mem_init(void) | |||
759 | set_highmem_pages_init(); | 754 | set_highmem_pages_init(); |
760 | 755 | ||
761 | /* this will put all low memory onto the freelists */ | 756 | /* this will put all low memory onto the freelists */ |
762 | totalram_pages += free_all_bootmem(); | 757 | free_all_bootmem(); |
763 | |||
764 | reservedpages = 0; | ||
765 | for (tmp = 0; tmp < max_low_pfn; tmp++) | ||
766 | /* | ||
767 | * Only count reserved RAM pages: | ||
768 | */ | ||
769 | if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp))) | ||
770 | reservedpages++; | ||
771 | 758 | ||
772 | after_bootmem = 1; | 759 | after_bootmem = 1; |
773 | 760 | ||
774 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | 761 | mem_init_print_info(NULL); |
775 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
776 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
777 | |||
778 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " | ||
779 | "%dk reserved, %dk data, %dk init, %ldk highmem)\n", | ||
780 | nr_free_pages() << (PAGE_SHIFT-10), | ||
781 | num_physpages << (PAGE_SHIFT-10), | ||
782 | codesize >> 10, | ||
783 | reservedpages << (PAGE_SHIFT-10), | ||
784 | datasize >> 10, | ||
785 | initsize >> 10, | ||
786 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
787 | |||
788 | printk(KERN_INFO "virtual kernel memory layout:\n" | 762 | printk(KERN_INFO "virtual kernel memory layout:\n" |
789 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | 763 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" |
790 | #ifdef CONFIG_HIGHMEM | 764 | #ifdef CONFIG_HIGHMEM |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index b3940b6b4d7e..104d56a9245f 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -712,36 +712,22 @@ EXPORT_SYMBOL_GPL(arch_add_memory); | |||
712 | 712 | ||
713 | static void __meminit free_pagetable(struct page *page, int order) | 713 | static void __meminit free_pagetable(struct page *page, int order) |
714 | { | 714 | { |
715 | struct zone *zone; | ||
716 | bool bootmem = false; | ||
717 | unsigned long magic; | 715 | unsigned long magic; |
718 | unsigned int nr_pages = 1 << order; | 716 | unsigned int nr_pages = 1 << order; |
719 | 717 | ||
720 | /* bootmem page has reserved flag */ | 718 | /* bootmem page has reserved flag */ |
721 | if (PageReserved(page)) { | 719 | if (PageReserved(page)) { |
722 | __ClearPageReserved(page); | 720 | __ClearPageReserved(page); |
723 | bootmem = true; | ||
724 | 721 | ||
725 | magic = (unsigned long)page->lru.next; | 722 | magic = (unsigned long)page->lru.next; |
726 | if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) { | 723 | if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) { |
727 | while (nr_pages--) | 724 | while (nr_pages--) |
728 | put_page_bootmem(page++); | 725 | put_page_bootmem(page++); |
729 | } else | 726 | } else |
730 | __free_pages_bootmem(page, order); | 727 | while (nr_pages--) |
728 | free_reserved_page(page++); | ||
731 | } else | 729 | } else |
732 | free_pages((unsigned long)page_address(page), order); | 730 | free_pages((unsigned long)page_address(page), order); |
733 | |||
734 | /* | ||
735 | * SECTION_INFO pages and MIX_SECTION_INFO pages | ||
736 | * are all allocated by bootmem. | ||
737 | */ | ||
738 | if (bootmem) { | ||
739 | zone = page_zone(page); | ||
740 | zone_span_writelock(zone); | ||
741 | zone->present_pages += nr_pages; | ||
742 | zone_span_writeunlock(zone); | ||
743 | totalram_pages += nr_pages; | ||
744 | } | ||
745 | } | 731 | } |
746 | 732 | ||
747 | static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd) | 733 | static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd) |
@@ -1058,9 +1044,6 @@ static void __init register_page_bootmem_info(void) | |||
1058 | 1044 | ||
1059 | void __init mem_init(void) | 1045 | void __init mem_init(void) |
1060 | { | 1046 | { |
1061 | long codesize, reservedpages, datasize, initsize; | ||
1062 | unsigned long absent_pages; | ||
1063 | |||
1064 | pci_iommu_alloc(); | 1047 | pci_iommu_alloc(); |
1065 | 1048 | ||
1066 | /* clear_bss() already clear the empty_zero_page */ | 1049 | /* clear_bss() already clear the empty_zero_page */ |
@@ -1068,29 +1051,14 @@ void __init mem_init(void) | |||
1068 | register_page_bootmem_info(); | 1051 | register_page_bootmem_info(); |
1069 | 1052 | ||
1070 | /* this will put all memory onto the freelists */ | 1053 | /* this will put all memory onto the freelists */ |
1071 | totalram_pages = free_all_bootmem(); | 1054 | free_all_bootmem(); |
1072 | |||
1073 | absent_pages = absent_pages_in_range(0, max_pfn); | ||
1074 | reservedpages = max_pfn - totalram_pages - absent_pages; | ||
1075 | after_bootmem = 1; | 1055 | after_bootmem = 1; |
1076 | 1056 | ||
1077 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
1078 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
1079 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
1080 | |||
1081 | /* Register memory areas for /proc/kcore */ | 1057 | /* Register memory areas for /proc/kcore */ |
1082 | kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, | 1058 | kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, |
1083 | VSYSCALL_END - VSYSCALL_START, KCORE_OTHER); | 1059 | VSYSCALL_END - VSYSCALL_START, KCORE_OTHER); |
1084 | 1060 | ||
1085 | printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " | 1061 | mem_init_print_info(NULL); |
1086 | "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n", | ||
1087 | nr_free_pages() << (PAGE_SHIFT-10), | ||
1088 | max_pfn << (PAGE_SHIFT-10), | ||
1089 | codesize >> 10, | ||
1090 | absent_pages << (PAGE_SHIFT-10), | ||
1091 | reservedpages << (PAGE_SHIFT-10), | ||
1092 | datasize >> 10, | ||
1093 | initsize >> 10); | ||
1094 | } | 1062 | } |
1095 | 1063 | ||
1096 | #ifdef CONFIG_DEBUG_RODATA | 1064 | #ifdef CONFIG_DEBUG_RODATA |
@@ -1166,11 +1134,10 @@ void mark_rodata_ro(void) | |||
1166 | set_memory_ro(start, (end-start) >> PAGE_SHIFT); | 1134 | set_memory_ro(start, (end-start) >> PAGE_SHIFT); |
1167 | #endif | 1135 | #endif |
1168 | 1136 | ||
1169 | free_init_pages("unused kernel memory", | 1137 | free_init_pages("unused kernel", |
1170 | (unsigned long) __va(__pa_symbol(text_end)), | 1138 | (unsigned long) __va(__pa_symbol(text_end)), |
1171 | (unsigned long) __va(__pa_symbol(rodata_start))); | 1139 | (unsigned long) __va(__pa_symbol(rodata_start))); |
1172 | 1140 | free_init_pages("unused kernel", | |
1173 | free_init_pages("unused kernel memory", | ||
1174 | (unsigned long) __va(__pa_symbol(rodata_end)), | 1141 | (unsigned long) __va(__pa_symbol(rodata_end)), |
1175 | (unsigned long) __va(__pa_symbol(_sdata))); | 1142 | (unsigned long) __va(__pa_symbol(_sdata))); |
1176 | } | 1143 | } |
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c index 73a6d7395bd3..0342d27ca798 100644 --- a/arch/x86/mm/numa_32.c +++ b/arch/x86/mm/numa_32.c | |||
@@ -83,10 +83,8 @@ void __init initmem_init(void) | |||
83 | highstart_pfn = max_low_pfn; | 83 | highstart_pfn = max_low_pfn; |
84 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | 84 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", |
85 | pages_to_mb(highend_pfn - highstart_pfn)); | 85 | pages_to_mb(highend_pfn - highstart_pfn)); |
86 | num_physpages = highend_pfn; | ||
87 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | 86 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; |
88 | #else | 87 | #else |
89 | num_physpages = max_low_pfn; | ||
90 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | 88 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; |
91 | #endif | 89 | #endif |
92 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", | 90 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", |
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index bba125b4bb06..479d7537a32a 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c | |||
@@ -173,39 +173,16 @@ void __init zones_init(void) | |||
173 | 173 | ||
174 | void __init mem_init(void) | 174 | void __init mem_init(void) |
175 | { | 175 | { |
176 | unsigned long codesize, reservedpages, datasize, initsize; | 176 | max_mapnr = max_low_pfn - ARCH_PFN_OFFSET; |
177 | unsigned long highmemsize, tmp, ram; | ||
178 | |||
179 | max_mapnr = num_physpages = max_low_pfn - ARCH_PFN_OFFSET; | ||
180 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); | 177 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); |
181 | highmemsize = 0; | ||
182 | 178 | ||
183 | #ifdef CONFIG_HIGHMEM | 179 | #ifdef CONFIG_HIGHMEM |
184 | #error HIGHGMEM not implemented in init.c | 180 | #error HIGHGMEM not implemented in init.c |
185 | #endif | 181 | #endif |
186 | 182 | ||
187 | totalram_pages += free_all_bootmem(); | 183 | free_all_bootmem(); |
188 | |||
189 | reservedpages = ram = 0; | ||
190 | for (tmp = 0; tmp < max_mapnr; tmp++) { | ||
191 | ram++; | ||
192 | if (PageReserved(mem_map+tmp)) | ||
193 | reservedpages++; | ||
194 | } | ||
195 | 184 | ||
196 | codesize = (unsigned long) _etext - (unsigned long) _stext; | 185 | mem_init_print_info(NULL); |
197 | datasize = (unsigned long) _edata - (unsigned long) _sdata; | ||
198 | initsize = (unsigned long) __init_end - (unsigned long) __init_begin; | ||
199 | |||
200 | printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, " | ||
201 | "%ldk data, %ldk init %ldk highmem)\n", | ||
202 | nr_free_pages() << (PAGE_SHIFT-10), | ||
203 | ram << (PAGE_SHIFT-10), | ||
204 | codesize >> 10, | ||
205 | reservedpages << (PAGE_SHIFT-10), | ||
206 | datasize >> 10, | ||
207 | initsize >> 10, | ||
208 | highmemsize >> 10); | ||
209 | } | 186 | } |
210 | 187 | ||
211 | #ifdef CONFIG_BLK_DEV_INITRD | 188 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -214,11 +191,11 @@ extern int initrd_is_mapped; | |||
214 | void free_initrd_mem(unsigned long start, unsigned long end) | 191 | void free_initrd_mem(unsigned long start, unsigned long end) |
215 | { | 192 | { |
216 | if (initrd_is_mapped) | 193 | if (initrd_is_mapped) |
217 | free_reserved_area(start, end, 0, "initrd"); | 194 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
218 | } | 195 | } |
219 | #endif | 196 | #endif |
220 | 197 | ||
221 | void free_initmem(void) | 198 | void free_initmem(void) |
222 | { | 199 | { |
223 | free_initmem_default(0); | 200 | free_initmem_default(-1); |
224 | } | 201 | } |