Skip to content

Commit

Permalink
Merge branch 'core-memblock-for-linus' of git://git.kernel.org/pub/sc…
Browse files Browse the repository at this point in the history
…m/linux/kernel/git/tip/tip

* 'core-memblock-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (52 commits)
  memblock: Reimplement memblock allocation using reverse free area iterator
  memblock: Kill early_node_map[]
  score: Use HAVE_MEMBLOCK_NODE_MAP
  s390: Use HAVE_MEMBLOCK_NODE_MAP
  mips: Use HAVE_MEMBLOCK_NODE_MAP
  ia64: Use HAVE_MEMBLOCK_NODE_MAP
  SuperH: Use HAVE_MEMBLOCK_NODE_MAP
  sparc: Use HAVE_MEMBLOCK_NODE_MAP
  powerpc: Use HAVE_MEMBLOCK_NODE_MAP
  memblock: Implement memblock_add_node()
  memblock: s/memblock_analyze()/memblock_allow_resize()/ and update users
  memblock: Track total size of regions automatically
  powerpc: Cleanup memblock usage
  memblock: Reimplement memblock_enforce_memory_limit() using __memblock_remove()
  memblock: Make memblock functions handle overflowing range @SiZe
  memblock: Reimplement __memblock_remove() using memblock_isolate_range()
  memblock: Separate out memblock_isolate_range() from memblock_set_node()
  memblock: Kill memblock_init()
  memblock: Kill sentinel entries at the end of static region arrays
  memblock: Add __memblock_dump_all()
  ...
  • Loading branch information
torvalds committed Jan 6, 2012
2 parents 15f043a + 45aa066 commit 4a2164a
Show file tree
Hide file tree
Showing 75 changed files with 1,032 additions and 1,747 deletions.
1 change: 1 addition & 0 deletions arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <asm/mach/time.h>
#include <asm/traps.h>
#include <asm/unwind.h>
#include <asm/memblock.h>

#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
#include "compat.h"
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/memblock.h>

#include "mm.h"

Expand Down Expand Up @@ -332,7 +333,6 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)

sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);

memblock_init();
for (i = 0; i < mi->nr_banks; i++)
memblock_add(mi->bank[i].start, mi->bank[i].size);

Expand Down Expand Up @@ -371,7 +371,7 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
if (mdesc->reserve)
mdesc->reserve();

memblock_analyze();
memblock_allow_resize();
memblock_dump_all();
}

Expand Down
6 changes: 3 additions & 3 deletions arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ config IA64
select HAVE_ARCH_TRACEHOOK
select HAVE_DMA_API_DEBUG
select HAVE_GENERIC_HARDIRQS
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
select ARCH_DISCARD_MEMBLOCK
select GENERIC_IRQ_PROBE
select GENERIC_PENDING_IRQ if SMP
select IRQ_PER_CPU
Expand Down Expand Up @@ -474,9 +477,6 @@ config NODES_SHIFT
MAX_NUMNODES will be 2^(This value).
If in doubt, use the default.

config ARCH_POPULATES_NODE_MAP
def_bool y

# VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
# VIRTUAL_MEM_MAP has been retained for historical reasons.
config VIRTUAL_MEM_MAP
Expand Down
3 changes: 2 additions & 1 deletion arch/ia64/mm/contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
#include <linux/bootmem.h>
#include <linux/efi.h>
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/nmi.h>
#include <linux/swap.h>
Expand Down Expand Up @@ -348,7 +349,7 @@ paging_init (void)
printk("Virtual mem_map starts at 0x%p\n", mem_map);
}
#else /* !CONFIG_VIRTUAL_MEM_MAP */
add_active_range(0, 0, max_low_pfn);
memblock_add_node(0, PFN_PHYS(max_low_pfn), 0);
free_area_init_nodes(max_zone_pfns);
#endif /* !CONFIG_VIRTUAL_MEM_MAP */
zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
Expand Down
4 changes: 2 additions & 2 deletions arch/ia64/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/bootmem.h>
#include <linux/efi.h>
#include <linux/elf.h>
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/module.h>
Expand Down Expand Up @@ -557,8 +558,7 @@ int __init register_active_ranges(u64 start, u64 len, int nid)
#endif

if (start < end)
add_active_range(nid, __pa(start) >> PAGE_SHIFT,
__pa(end) >> PAGE_SHIFT);
memblock_add_node(__pa(start), end - start, nid);
return 0;
}

Expand Down
14 changes: 0 additions & 14 deletions arch/microblaze/include/asm/memblock.h

This file was deleted.

3 changes: 1 addition & 2 deletions arch/microblaze/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,14 @@ void __init early_init_devtree(void *params)
of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);

/* Scan memory nodes and rebuild MEMBLOCKs */
memblock_init();
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory, NULL);

/* Save command line for /proc/cmdline and then parse parameters */
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
parse_early_param();

memblock_analyze();
memblock_allow_resize();

pr_debug("Phys. mem: %lx\n", (unsigned long) memblock_phys_mem_size());

Expand Down
6 changes: 3 additions & 3 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ config MIPS
select GENERIC_IRQ_SHOW
select HAVE_ARCH_JUMP_LABEL
select IRQ_FORCED_THREADING
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
select ARCH_DISCARD_MEMBLOCK

menu "Machine selection"

Expand Down Expand Up @@ -2064,9 +2067,6 @@ config ARCH_DISCONTIGMEM_ENABLE
or have huge holes in the physical address space for other reasons.
See <file:Documentation/vm/numa> for more.

config ARCH_POPULATES_NODE_MAP
def_bool y

config ARCH_SPARSEMEM_ENABLE
bool
select SPARSEMEM_STATIC
Expand Down
3 changes: 2 additions & 1 deletion arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/ioport.h>
#include <linux/export.h>
#include <linux/screen_info.h>
#include <linux/memblock.h>
#include <linux/bootmem.h>
#include <linux/initrd.h>
#include <linux/root_dev.h>
Expand Down Expand Up @@ -352,7 +353,7 @@ static void __init bootmem_init(void)
continue;
#endif

add_active_range(0, start, end);
memblock_add_node(PFN_PHYS(start), PFN_PHYS(end - start), 0);
}

/*
Expand Down
5 changes: 3 additions & 2 deletions arch/mips/sgi-ip27/ip27-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/module.h>
Expand Down Expand Up @@ -381,8 +382,8 @@ static void __init szmem(void)
continue;
}
num_physpages += slot_psize;
add_active_range(node, slot_getbasepfn(node, slot),
slot_getbasepfn(node, slot) + slot_psize);
memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)),
PFN_PHYS(slot_psize), node);
}
}
}
Expand Down
24 changes: 0 additions & 24 deletions arch/openrisc/include/asm/memblock.h

This file was deleted.

3 changes: 1 addition & 2 deletions arch/openrisc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,13 @@ void __init early_init_devtree(void *params)
of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);

/* Scan memory nodes and rebuild MEMBLOCKs */
memblock_init();
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory, NULL);

/* Save command line for /proc/cmdline and then parse parameters */
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);

memblock_analyze();
memblock_allow_resize();

/* We must copy the flattend device tree from init memory to regular
* memory because the device tree references the strings in it
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ config PPC
select HAVE_KRETPROBES
select HAVE_ARCH_TRACEHOOK
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
select USE_GENERIC_SMP_HELPERS if SMP
Expand Down Expand Up @@ -421,9 +422,6 @@ config ARCH_SPARSEMEM_DEFAULT
def_bool y
depends on (SMP && PPC_PSERIES) || PPC_PS3

config ARCH_POPULATES_NODE_MAP
def_bool y

config SYS_SUPPORTS_HUGETLBFS
bool

Expand Down
8 changes: 0 additions & 8 deletions arch/powerpc/include/asm/memblock.h

This file was deleted.

3 changes: 0 additions & 3 deletions arch/powerpc/kernel/machine_kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ void __init reserve_crashkernel(void)
unsigned long long crash_size, crash_base;
int ret;

/* this is necessary because of memblock_phys_mem_size() */
memblock_analyze();

/* use common parsing */
ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
&crash_size, &crash_base);
Expand Down
20 changes: 6 additions & 14 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,6 @@ void __init early_init_devtree(void *params)
of_scan_flat_dt(early_init_dt_scan_chosen_ppc, cmd_line);

/* Scan memory nodes and rebuild MEMBLOCKs */
memblock_init();

of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);

Expand All @@ -756,20 +754,14 @@ void __init early_init_devtree(void *params)
early_reserve_mem();
phyp_dump_reserve_mem();

limit = memory_limit;
if (! limit) {
phys_addr_t memsize;

/* Ensure that total memory size is page-aligned, because
* otherwise mark_bootmem() gets upset. */
memblock_analyze();
memsize = memblock_phys_mem_size();
if ((memsize & PAGE_MASK) != memsize)
limit = memsize & PAGE_MASK;
}
/*
* Ensure that total memory size is page-aligned, because otherwise
* mark_bootmem() gets upset.
*/
limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE);
memblock_enforce_memory_limit(limit);

memblock_analyze();
memblock_allow_resize();
memblock_dump_all();

DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ void __init MMU_init(void)

if (memblock.memory.cnt > 1) {
#ifndef CONFIG_WII
memblock.memory.cnt = 1;
memblock_analyze();
memblock_enforce_memory_limit(memblock.memory.regions[0].size);
printk(KERN_WARNING "Only using first contiguous memory region");
#else
wii_memory_fixups();
Expand All @@ -158,7 +157,6 @@ void __init MMU_init(void)
#ifndef CONFIG_HIGHMEM
total_memory = total_lowmem;
memblock_enforce_memory_limit(total_lowmem);
memblock_analyze();
#endif /* CONFIG_HIGHMEM */
}

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/mm/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void __init do_init_bootmem(void)
unsigned long start_pfn, end_pfn;
start_pfn = memblock_region_memory_base_pfn(reg);
end_pfn = memblock_region_memory_end_pfn(reg);
add_active_range(0, start_pfn, end_pfn);
memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
}

/* Add all physical memory to the bootmem map, mark each area
Expand Down
Loading

0 comments on commit 4a2164a

Please sign in to comment.