Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mm: Eliminate unneeded for_each_memblock

The only persistent change made by this loop is calling
memblock_set_node() once for each memblock, which is not useful (and has
no effect) as memblock_set_node() is not called with any
memblock-specific parameters.

Subsistute a single memblock_set_node().

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Cody P Schafer and committed by
Benjamin Herrenschmidt
4e8309ba dfd0436a

+4 -7
+4 -7
arch/powerpc/mm/mem.c
··· 195 195 min_low_pfn = MEMORY_START >> PAGE_SHIFT; 196 196 boot_mapsize = init_bootmem_node(NODE_DATA(0), start >> PAGE_SHIFT, min_low_pfn, max_low_pfn); 197 197 198 - /* Add active regions with valid PFNs */ 199 - for_each_memblock(memory, reg) { 200 - unsigned long start_pfn, end_pfn; 201 - start_pfn = memblock_region_memory_base_pfn(reg); 202 - end_pfn = memblock_region_memory_end_pfn(reg); 203 - memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 204 - } 198 + /* Place all memblock_regions in the same node and merge contiguous 199 + * memblock_regions 200 + */ 201 + memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 205 202 206 203 /* Add all physical memory to the bootmem map, mark each area 207 204 * present.