diff options
author | Tejun Heo <tj@kernel.org> | 2011-12-08 13:22:08 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-12-08 13:22:08 -0500 |
commit | 1aadc0560f46530f8a0f11055285b876a8a31770 (patch) | |
tree | 9d57dbe134894d4f8d20cfd246ac9457af65b271 | |
parent | 1440c4e2c918532f39131c3330fe2226e16be7b6 (diff) |
memblock: s/memblock_analyze()/memblock_allow_resize()/ and update users
The only function of memblock_analyze() is now allowing resize of
memblock region arrays. Rename it to memblock_allow_resize() and
update its users.
* The following users remain the same other than renaming.
arm/mm/init.c::arm_memblock_init()
microblaze/kernel/prom.c::early_init_devtree()
powerpc/kernel/prom.c::early_init_devtree()
openrisc/kernel/prom.c::early_init_devtree()
sh/mm/init.c::paging_init()
sparc/mm/init_64.c::paging_init()
unicore32/mm/init.c::uc32_memblock_init()
* In the following users, analyze was used to update total size which
is no longer necessary.
powerpc/kernel/machine_kexec.c::reserve_crashkernel()
powerpc/kernel/prom.c::early_init_devtree()
powerpc/mm/init_32.c::MMU_init()
powerpc/mm/tlb_nohash.c::__early_init_mmu()
powerpc/platforms/ps3/mm.c::ps3_mm_add_memory()
powerpc/platforms/embedded6xx/wii.c::wii_memory_fixups()
sh/kernel/machine_kexec.c::reserve_crashkernel()
* x86/kernel/e820.c::memblock_x86_fill() was directly setting
memblock_can_resize before populating memblock and calling analyze
afterwards. Call memblock_allow_resize() before start populating.
memblock_can_resize is now static inside memblock.c.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: "H. Peter Anvin" <hpa@zytor.com>
-rw-r--r-- | arch/arm/mm/init.c | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/prom.c | 2 | ||||
-rw-r--r-- | arch/openrisc/kernel/prom.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/machine_kexec.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 3 | ||||
-rw-r--r-- | arch/powerpc/mm/init_32.c | 2 | ||||
-rw-r--r-- | arch/powerpc/mm/tlb_nohash.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/wii.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/mm.c | 1 | ||||
-rw-r--r-- | arch/sh/kernel/machine_kexec.c | 3 | ||||
-rw-r--r-- | arch/sh/mm/init.c | 2 | ||||
-rw-r--r-- | arch/sparc/mm/init_64.c | 2 | ||||
-rw-r--r-- | arch/unicore32/mm/init.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/e820.c | 3 | ||||
-rw-r--r-- | include/linux/memblock.h | 3 | ||||
-rw-r--r-- | mm/memblock.c | 5 |
16 files changed, 11 insertions, 26 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 4140843399ca..7c38474e533a 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -371,7 +371,7 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) | |||
371 | if (mdesc->reserve) | 371 | if (mdesc->reserve) |
372 | mdesc->reserve(); | 372 | mdesc->reserve(); |
373 | 373 | ||
374 | memblock_analyze(); | 374 | memblock_allow_resize(); |
375 | memblock_dump_all(); | 375 | memblock_dump_all(); |
376 | } | 376 | } |
377 | 377 | ||
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index 4d65e9721f60..80d314e81901 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c | |||
@@ -129,7 +129,7 @@ void __init early_init_devtree(void *params) | |||
129 | strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); | 129 | strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); |
130 | parse_early_param(); | 130 | parse_early_param(); |
131 | 131 | ||
132 | memblock_analyze(); | 132 | memblock_allow_resize(); |
133 | 133 | ||
134 | pr_debug("Phys. mem: %lx\n", (unsigned long) memblock_phys_mem_size()); | 134 | pr_debug("Phys. mem: %lx\n", (unsigned long) memblock_phys_mem_size()); |
135 | 135 | ||
diff --git a/arch/openrisc/kernel/prom.c b/arch/openrisc/kernel/prom.c index 7dbc6e090b81..3d4478f6c942 100644 --- a/arch/openrisc/kernel/prom.c +++ b/arch/openrisc/kernel/prom.c | |||
@@ -82,7 +82,7 @@ void __init early_init_devtree(void *params) | |||
82 | /* Save command line for /proc/cmdline and then parse parameters */ | 82 | /* Save command line for /proc/cmdline and then parse parameters */ |
83 | strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); | 83 | strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); |
84 | 84 | ||
85 | memblock_analyze(); | 85 | memblock_allow_resize(); |
86 | 86 | ||
87 | /* We must copy the flattend device tree from init memory to regular | 87 | /* We must copy the flattend device tree from init memory to regular |
88 | * memory because the device tree references the strings in it | 88 | * memory because the device tree references the strings in it |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index 9ce1672afb59..a2158a395d96 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -107,9 +107,6 @@ void __init reserve_crashkernel(void) | |||
107 | unsigned long long crash_size, crash_base; | 107 | unsigned long long crash_size, crash_base; |
108 | int ret; | 108 | int ret; |
109 | 109 | ||
110 | /* this is necessary because of memblock_phys_mem_size() */ | ||
111 | memblock_analyze(); | ||
112 | |||
113 | /* use common parsing */ | 110 | /* use common parsing */ |
114 | ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), | 111 | ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), |
115 | &crash_size, &crash_base); | 112 | &crash_size, &crash_base); |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 28500d4f29d9..abe405dab34d 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -758,11 +758,10 @@ void __init early_init_devtree(void *params) | |||
758 | * Ensure that total memory size is page-aligned, because otherwise | 758 | * Ensure that total memory size is page-aligned, because otherwise |
759 | * mark_bootmem() gets upset. | 759 | * mark_bootmem() gets upset. |
760 | */ | 760 | */ |
761 | memblock_analyze(); | ||
762 | limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE); | 761 | limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE); |
763 | memblock_enforce_memory_limit(limit); | 762 | memblock_enforce_memory_limit(limit); |
764 | 763 | ||
765 | memblock_analyze(); | 764 | memblock_allow_resize(); |
766 | memblock_dump_all(); | 765 | memblock_dump_all(); |
767 | 766 | ||
768 | DBG("Phys. mem: %llx\n", memblock_phys_mem_size()); | 767 | DBG("Phys. mem: %llx\n", memblock_phys_mem_size()); |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 12bb528e51c5..58861fa1220e 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -135,7 +135,6 @@ void __init MMU_init(void) | |||
135 | if (memblock.memory.cnt > 1) { | 135 | if (memblock.memory.cnt > 1) { |
136 | #ifndef CONFIG_WII | 136 | #ifndef CONFIG_WII |
137 | memblock_enforce_memory_limit(memblock.memory.regions[0].size); | 137 | memblock_enforce_memory_limit(memblock.memory.regions[0].size); |
138 | memblock_analyze(); | ||
139 | printk(KERN_WARNING "Only using first contiguous memory region"); | 138 | printk(KERN_WARNING "Only using first contiguous memory region"); |
140 | #else | 139 | #else |
141 | wii_memory_fixups(); | 140 | wii_memory_fixups(); |
@@ -158,7 +157,6 @@ void __init MMU_init(void) | |||
158 | #ifndef CONFIG_HIGHMEM | 157 | #ifndef CONFIG_HIGHMEM |
159 | total_memory = total_lowmem; | 158 | total_memory = total_lowmem; |
160 | memblock_enforce_memory_limit(total_lowmem); | 159 | memblock_enforce_memory_limit(total_lowmem); |
161 | memblock_analyze(); | ||
162 | #endif /* CONFIG_HIGHMEM */ | 160 | #endif /* CONFIG_HIGHMEM */ |
163 | } | 161 | } |
164 | 162 | ||
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c index 4e13d6f9023e..573ba3b69d1f 100644 --- a/arch/powerpc/mm/tlb_nohash.c +++ b/arch/powerpc/mm/tlb_nohash.c | |||
@@ -615,7 +615,6 @@ static void __early_init_mmu(int boot_cpu) | |||
615 | 615 | ||
616 | /* limit memory so we dont have linear faults */ | 616 | /* limit memory so we dont have linear faults */ |
617 | memblock_enforce_memory_limit(linear_map_top); | 617 | memblock_enforce_memory_limit(linear_map_top); |
618 | memblock_analyze(); | ||
619 | 618 | ||
620 | patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e); | 619 | patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e); |
621 | patch_exception(0x1e0, exc_instruction_tlb_miss_bolted_book3e); | 620 | patch_exception(0x1e0, exc_instruction_tlb_miss_bolted_book3e); |
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c index 1cbe9d3c7977..6d8dadf19f0b 100644 --- a/arch/powerpc/platforms/embedded6xx/wii.c +++ b/arch/powerpc/platforms/embedded6xx/wii.c | |||
@@ -88,7 +88,6 @@ void __init wii_memory_fixups(void) | |||
88 | wii_hole_size = p[1].base - wii_hole_start; | 88 | wii_hole_size = p[1].base - wii_hole_start; |
89 | memblock_add(wii_hole_start, wii_hole_size); | 89 | memblock_add(wii_hole_start, wii_hole_size); |
90 | memblock_reserve(wii_hole_start, wii_hole_size); | 90 | memblock_reserve(wii_hole_start, wii_hole_size); |
91 | memblock_analyze(); | ||
92 | 91 | ||
93 | BUG_ON(memblock.memory.cnt != 1); | 92 | BUG_ON(memblock.memory.cnt != 1); |
94 | __memblock_dump_all(); | 93 | __memblock_dump_all(); |
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 72714ad27842..8bd6ba542691 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -319,7 +319,6 @@ static int __init ps3_mm_add_memory(void) | |||
319 | } | 319 | } |
320 | 320 | ||
321 | memblock_add(start_addr, map.r1.size); | 321 | memblock_add(start_addr, map.r1.size); |
322 | memblock_analyze(); | ||
323 | 322 | ||
324 | result = online_pages(start_pfn, nr_pages); | 323 | result = online_pages(start_pfn, nr_pages); |
325 | 324 | ||
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c index c5a33f007f88..9fea49f6e667 100644 --- a/arch/sh/kernel/machine_kexec.c +++ b/arch/sh/kernel/machine_kexec.c | |||
@@ -157,9 +157,6 @@ void __init reserve_crashkernel(void) | |||
157 | unsigned long long crash_size, crash_base; | 157 | unsigned long long crash_size, crash_base; |
158 | int ret; | 158 | int ret; |
159 | 159 | ||
160 | /* this is necessary because of memblock_phys_mem_size() */ | ||
161 | memblock_analyze(); | ||
162 | |||
163 | ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), | 160 | ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), |
164 | &crash_size, &crash_base); | 161 | &crash_size, &crash_base); |
165 | if (ret == 0 && crash_size > 0) { | 162 | if (ret == 0 && crash_size > 0) { |
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 2528962609f8..82cc576fab15 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -336,7 +336,7 @@ void __init paging_init(void) | |||
336 | sh_mv.mv_mem_reserve(); | 336 | sh_mv.mv_mem_reserve(); |
337 | 337 | ||
338 | memblock_enforce_memory_limit(memory_limit); | 338 | memblock_enforce_memory_limit(memory_limit); |
339 | memblock_analyze(); | 339 | memblock_allow_resize(); |
340 | 340 | ||
341 | memblock_dump_all(); | 341 | memblock_dump_all(); |
342 | 342 | ||
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index f42cc878bf97..29723a2031fc 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -1794,7 +1794,7 @@ void __init paging_init(void) | |||
1794 | 1794 | ||
1795 | memblock_enforce_memory_limit(cmdline_memory_size); | 1795 | memblock_enforce_memory_limit(cmdline_memory_size); |
1796 | 1796 | ||
1797 | memblock_analyze(); | 1797 | memblock_allow_resize(); |
1798 | memblock_dump_all(); | 1798 | memblock_dump_all(); |
1799 | 1799 | ||
1800 | set_bit(0, mmu_context_bmap); | 1800 | set_bit(0, mmu_context_bmap); |
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c index 01e235bd669d..de186bde8975 100644 --- a/arch/unicore32/mm/init.c +++ b/arch/unicore32/mm/init.c | |||
@@ -264,7 +264,7 @@ void __init uc32_memblock_init(struct meminfo *mi) | |||
264 | 264 | ||
265 | uc32_mm_memblock_reserve(); | 265 | uc32_mm_memblock_reserve(); |
266 | 266 | ||
267 | memblock_analyze(); | 267 | memblock_allow_resize(); |
268 | memblock_dump_all(); | 268 | memblock_dump_all(); |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 056e65d5012b..8071e2f3d6eb 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -1072,7 +1072,7 @@ void __init memblock_x86_fill(void) | |||
1072 | * We are safe to enable resizing, beause memblock_x86_fill() | 1072 | * We are safe to enable resizing, beause memblock_x86_fill() |
1073 | * is rather later for x86 | 1073 | * is rather later for x86 |
1074 | */ | 1074 | */ |
1075 | memblock_can_resize = 1; | 1075 | memblock_allow_resize(); |
1076 | 1076 | ||
1077 | for (i = 0; i < e820.nr_map; i++) { | 1077 | for (i = 0; i < e820.nr_map; i++) { |
1078 | struct e820entry *ei = &e820.map[i]; | 1078 | struct e820entry *ei = &e820.map[i]; |
@@ -1087,7 +1087,6 @@ void __init memblock_x86_fill(void) | |||
1087 | memblock_add(ei->addr, ei->size); | 1087 | memblock_add(ei->addr, ei->size); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | memblock_analyze(); | ||
1091 | memblock_dump_all(); | 1090 | memblock_dump_all(); |
1092 | } | 1091 | } |
1093 | 1092 | ||
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 5bb15005f0f7..c5b3bbc75897 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -42,7 +42,6 @@ struct memblock { | |||
42 | 42 | ||
43 | extern struct memblock memblock; | 43 | extern struct memblock memblock; |
44 | extern int memblock_debug; | 44 | extern int memblock_debug; |
45 | extern int memblock_can_resize; | ||
46 | 45 | ||
47 | #define memblock_dbg(fmt, ...) \ | 46 | #define memblock_dbg(fmt, ...) \ |
48 | if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | 47 | if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
@@ -52,7 +51,7 @@ phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, | |||
52 | int memblock_free_reserved_regions(void); | 51 | int memblock_free_reserved_regions(void); |
53 | int memblock_reserve_reserved_regions(void); | 52 | int memblock_reserve_reserved_regions(void); |
54 | 53 | ||
55 | void memblock_analyze(void); | 54 | void memblock_allow_resize(void); |
56 | int memblock_add(phys_addr_t base, phys_addr_t size); | 55 | int memblock_add(phys_addr_t base, phys_addr_t size); |
57 | int memblock_remove(phys_addr_t base, phys_addr_t size); | 56 | int memblock_remove(phys_addr_t base, phys_addr_t size); |
58 | int memblock_free(phys_addr_t base, phys_addr_t size); | 57 | int memblock_free(phys_addr_t base, phys_addr_t size); |
diff --git a/mm/memblock.c b/mm/memblock.c index f39964184b4a..a3ca95f35e03 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -36,7 +36,7 @@ struct memblock memblock __initdata_memblock = { | |||
36 | }; | 36 | }; |
37 | 37 | ||
38 | int memblock_debug __initdata_memblock; | 38 | int memblock_debug __initdata_memblock; |
39 | int memblock_can_resize __initdata_memblock; | 39 | static int memblock_can_resize __initdata_memblock; |
40 | 40 | ||
41 | /* inline so we don't get a warning when pr_debug is compiled out */ | 41 | /* inline so we don't get a warning when pr_debug is compiled out */ |
42 | static inline const char *memblock_type_name(struct memblock_type *type) | 42 | static inline const char *memblock_type_name(struct memblock_type *type) |
@@ -918,9 +918,8 @@ void __init_memblock __memblock_dump_all(void) | |||
918 | memblock_dump(&memblock.reserved, "reserved"); | 918 | memblock_dump(&memblock.reserved, "reserved"); |
919 | } | 919 | } |
920 | 920 | ||
921 | void __init memblock_analyze(void) | 921 | void __init memblock_allow_resize(void) |
922 | { | 922 | { |
923 | /* We allow resizing from there */ | ||
924 | memblock_can_resize = 1; | 923 | memblock_can_resize = 1; |
925 | } | 924 | } |
926 | 925 | ||