powerpc: Remove bootmem allocator
Subsystems (6)
PATCH 1/5 powerpc: Remove bootmem allocator
At the moment we transition from the memblock alloctor to the bootmem allocator. Removing the bootmem allocator removes a bunch of complicated code (most of which I owe the dubious honour of being responsible for writing).
---
arch/powerpc/Kconfig +1 -0
@@ -145,6 +145,7 @@ config PPC select HAVE_IRQ_EXIT_ON_IRQ_STACK select ARCH_USE_CMPXCHG_LOCKREF if PPC64 select HAVE_ARCH_AUDITSYSCALL + select NO_BOOTMEM config GENERIC_CSUM def_bool CPU_LITTLE_ENDIAN
arch/powerpc/include/asm/setup.h +1 -2
@@ -8,7 +8,6 @@ extern void ppc_printk_progress(char *s,extern unsigned int rtas_data;extern int mem_init_done;/* set on boot once kmalloc can be called */ -extern int init_bootmem_done;/* set once bootmem is available */ extern unsigned long long memory_limit;extern unsigned long klimit;extern void *zalloc_maybe_bootmem (size_t size,gfp_t mask);
@@ -24,7 +23,7 @@ extern void reloc_got2(unsigned long);#define PTRRELOC (x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))void check_for_initrd (void ); -void do_init_bootmem (void ); +void initmem_init (void );void setup_panic (void );#define ARCH_PANIC_TIMEOUT 180
arch/powerpc/kernel/setup_32.c +2 -3
@@ -311,9 +311,8 @@ void __init setup_arch(char **cmdline_p)irqstack_early_init (); -/* set up the bootmem stuff with available memory */ -do_init_bootmem (); -if ( ppc_md.progress ) ppc_md.progress ("setup_arch: bootmem" ,0x3eab ); +initmem_init (); +if ( ppc_md.progress ) ppc_md.progress ("setup_arch: initmem" ,0x3eab );#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;
arch/powerpc/kernel/setup_64.c +1 -2
@@ -677,8 +677,7 @@ void __init setup_arch(char **cmdline_p)exc_lvl_early_init ();emergency_stack_init (); -/* set up the bootmem stuff with available memory */ -do_init_bootmem (); +initmem_init ();sparse_init ();#ifdef CONFIG_DUMMY_CONSOLE
arch/powerpc/mm/init_32.c +0 -9
@@ -195,15 +195,6 @@ void __init MMU_init(void)memblock_set_current_limit (lowmem_end_addr); } -/* This is only called until mem_init is done. */ -void __init *early_get_page (void ) -{ -if (init_bootmem_done) -return alloc_bootmem_pages (PAGE_SIZE ); -else -return __va (memblock_alloc (PAGE_SIZE ,PAGE_SIZE )); -} -#ifdef CONFIG_8xx/* No 8xx specific .c file to put that in ... */ void setup_initial_memory_limit (phys_addr_t first_memblock_base,phys_addr_t first_memblock_size)
arch/powerpc/mm/mem.c +2 -60
100 lines not on this page · raw message
arch/powerpc/mm/numa.c +32 -188
258 lines not on this page · raw message
arch/powerpc/mm/pgtable_32.c +1 -2
@@ -100,12 +100,11 @@ __init_refok pte_t *pte_alloc_one_kernel {pte_t *pte;extern int mem_init_done; -extern void *early_get_page (void );if (mem_init_done) { pte = (pte_t *)__get_free_page (GFP_KERNEL |__GFP_REPEAT|__GFP_ZERO); }else { - pte = (pte_t *)early_get_page (); + pte =__va (memblock_alloc (PAGE_SIZE ,PAGE_SIZE ));if (pte)clear_page (pte); }
arch/powerpc/mm/pgtable_64.c +1 -5
@@ -72,11 +72,7 @@ static void *early_alloc_pgtable(unsigne {void *pt; -if (init_bootmem_done) - pt =__alloc_bootmem (size, size,__pa (MAX_DMA_ADDRESS )); -else - pt =__va (memblock_alloc_base (size, size, -__pa (MAX_DMA_ADDRESS ))); + pt =__va (memblock_alloc_base (size, size,__pa (MAX_DMA_ADDRESS )));memset (pt,0 , size);return pt;
PATCH 2/5 powerpc: Remove some old bootmem related comments
Now bootmem is gone from powerpc we can remove comments mentioning it.
---
arch/powerpc/kernel/prom.c +1 -4
@@ -695,10 +695,7 @@ void __init early_init_devtree(void *parreserve_crashkernel ();early_reserve_mem (); -/* -* Ensure that total memory size is page-aligned, because otherwise -* mark_bootmem() gets upset. -*/ +/* Ensure that total memory size is page-aligned. */ limit =ALIGN (memory_limit ?:memblock_phys_mem_size (),PAGE_SIZE );memblock_enforce_memory_limit (limit);
arch/powerpc/kernel/rtas.c +2 -2
@@ -1091,8 +1091,8 @@ asmlinkage int ppc_rtas(struct rtas_args }/* -* Call early during boot, before mem init or bootmem, to retrieve the RTAS -* informations from the device-tree and allocate the RMO buffer for userland +* Call early during boot, before mem init, to retrieve the RTAS +* information from the device-tree and allocate the RMO buffer for userland * accesses. */ void __init rtas_initialize (void )
arch/powerpc/mm/pgtable_64.c +0 -4
@@ -106,10 +106,6 @@ int map_kernel_page(unsigned long ea, un __pgprot(flags))); }else { #ifdef CONFIG_PPC_MMU_NOHASH - /* Warning ! This will blow up if bootmem is not initialized - * which our ppc64 code is keen to do that, we'll need to - * fix it and/or be more careful - */ pgdp = pgd_offset_k(ea); #ifdef PUD_TABLE_SIZE if (pgd_none(*pgdp)) {
arch/powerpc/kvm/book3s_hv_builtin.c +1 -1
@@ -148,7 +148,7 @@ EXPORT_SYMBOL_GPL(kvm_release_hpt);* kvm_cma_reserve() - reserve area for kvm hash pagetable * * This function reserves memory from early allocator. It should be -* called by arch specific code once the early allocator (memblock or bootmem) +* called by arch specific code once the memblock allocator * has been activated and all other subsystems have already allocated/reserved * memory. */
arch/powerpc/kvm/book3s_hv_cma.c +1 -1
@@ -42,7 +42,7 @@ static struct kvm_cma kvm_cma_area;* @alignment: Alignment for the contiguous memory area * * This function reserves memory for kvm cma area. It should be -* called by arch code when early allocator (memblock or bootmem) +* called by arch code when the memblock allocator * is still activate. */ long __init kvm_cma_declare_contiguous (phys_addr_t size,phys_addr_t alignment)
arch/powerpc/mm/hugetlbpage.c +2 -2
@@ -276,7 +276,7 @@ pte_t *huge_pte_alloc(struct mm_struct *#ifdef CONFIG_PPC_FSL_BOOK3E /* Build list of addresses of gigantic pages. This function is used in early -* boot before the buddy or bootmem allocator is setup. +* boot before the buddy allocator is setup. */ void add_gpage (u64 addr,u64 page_size,unsigned long number_of_pages) {
@@ -399,7 +399,7 @@ void __init reserve_hugetlb_gpages(void)#else /* !PPC_FSL_BOOK3E */ /* Build list of addresses of gigantic pages. This function is used in early -* boot before the buddy or bootmem allocator is setup. +* boot before the buddy allocator is setup. */ void add_gpage (u64 addr,u64 page_size,unsigned long number_of_pages) {
PATCH 3/5 powerpc: Remove superfluous bootmem includes
In reply to Anton BlanchardLots of places included bootmem.h even when not using bootmem.
---
arch/powerpc/kernel/crash_dump.c +0 -1
@@ -12,7 +12,6 @@#undef DEBUG#include <linux/crash_dump.h> -#include <linux/bootmem.h> #include <linux/memblock.h> #include <asm/code-patching.h> #include <asm/kdump.h>
arch/powerpc/kernel/irq.c +0 -1
@@ -50,7 +50,6 @@#include <linux/list.h> #include <linux/radix-tree.h> #include <linux/mutex.h> -#include <linux/bootmem.h> #include <linux/pci.h> #include <linux/debugfs.h> #include <linux/of.h>
arch/powerpc/kernel/pci_64.c +0 -1
@@ -17,7 +17,6 @@#include <linux/pci.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/export.h> #include <linux/mm.h> #include <linux/list.h>
arch/powerpc/kernel/rtas_pci.c +0 -1
@@ -26,7 +26,6 @@#include <linux/pci.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <asm/io.h> #include <asm/pgtable.h>
arch/powerpc/kernel/vdso.c +0 -1
@@ -20,7 +20,6 @@#include <linux/user.h> #include <linux/elf.h> #include <linux/security.h> -#include <linux/bootmem.h> #include <linux/memblock.h> #include <asm/pgtable.h>
arch/powerpc/mm/init_64.c +0 -1
@@ -34,7 +34,6 @@#include <linux/vmalloc.h> #include <linux/init.h> #include <linux/delay.h> -#include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/idr.h> #include <linux/nodemask.h>
arch/powerpc/platforms/cell/celleb_scc_epci.c +0 -1
@@ -25,7 +25,6 @@#include <linux/pci.h> #include <linux/init.h> #include <linux/pci_regs.h> -#include <linux/bootmem.h> #include <asm/io.h> #include <asm/irq.h>
arch/powerpc/platforms/cell/celleb_scc_pciex.c +0 -1
@@ -25,7 +25,6 @@#include <linux/string.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/delay.h> #include <linux/interrupt.h>
arch/powerpc/platforms/powermac/pci.c +0 -1
@@ -15,7 +15,6 @@#include <linux/delay.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/irq.h> #include <linux/of_pci.h>
arch/powerpc/platforms/powernv/eeh-ioda.c +0 -1
@@ -11,7 +11,6 @@* (at your option) any later version. */ -#include <linux/bootmem.h> #include <linux/debugfs.h> #include <linux/delay.h> #include <linux/io.h>
arch/powerpc/platforms/powernv/pci.c +0 -1
@@ -16,7 +16,6 @@#include <linux/delay.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/irq.h> #include <linux/io.h> #include <linux/msi.h>
arch/powerpc/sysdev/fsl_msi.c +0 -1
@@ -13,7 +13,6 @@* */ #include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/msi.h> #include <linux/pci.h> #include <linux/slab.h>
arch/powerpc/sysdev/ipic.c +0 -1
@@ -20,7 +20,6 @@#include <linux/signal.h> #include <linux/syscore_ops.h> #include <linux/device.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <linux/fsl_devices.h> #include <asm/irq.h>
arch/powerpc/sysdev/mpic.c +0 -1
@@ -24,7 +24,6 @@#include <linux/irq.h> #include <linux/smp.h> #include <linux/interrupt.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <linux/pci.h> #include <linux/slab.h>
arch/powerpc/sysdev/ppc4xx_msi.c +0 -1
@@ -22,7 +22,6 @@*/ #include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/pci.h> #include <linux/msi.h> #include <linux/of_platform.h>
arch/powerpc/sysdev/ppc4xx_pci.c +0 -1
@@ -22,7 +22,6 @@#include <linux/pci.h> #include <linux/init.h> #include <linux/of.h> -#include <linux/bootmem.h> #include <linux/delay.h> #include <linux/slab.h>
arch/powerpc/sysdev/qe_lib/qe.c +0 -1
@@ -22,7 +22,6 @@#include <linux/spinlock.h> #include <linux/mm.h> #include <linux/interrupt.h> -#include <linux/bootmem.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/ioport.h>
arch/powerpc/sysdev/qe_lib/qe_ic.c +0 -1
@@ -23,7 +23,6 @@#include <linux/sched.h> #include <linux/signal.h> #include <linux/device.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <asm/irq.h> #include <asm/io.h>
arch/powerpc/sysdev/uic.c +0 -1
@@ -19,7 +19,6 @@#include <linux/sched.h> #include <linux/signal.h> #include <linux/device.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <linux/irq.h> #include <linux/interrupt.h>
arch/powerpc/kvm/book3s_hv_builtin.c +0 -1
@@ -12,7 +12,6 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/spinlock.h> -#include <linux/bootmem.h> #include <linux/init.h> #include <linux/memblock.h> #include <linux/sizes.h>
arch/powerpc/platforms/maple/pci.c +0 -1
@@ -15,7 +15,6 @@#include <linux/delay.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/irq.h> #include <asm/sections.h>
arch/powerpc/sysdev/mpic_pasemi_msi.c +0 -1
@@ -16,7 +16,6 @@#undef DEBUG#include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/msi.h> #include <asm/mpic.h> #include <asm/prom.h>
arch/powerpc/sysdev/mpic_u3msi.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/msi.h> #include <asm/mpic.h> #include <asm/prom.h>
arch/powerpc/kernel/setup_32.c +0 -1
@@ -11,7 +11,6 @@#include <linux/delay.h> #include <linux/initrd.h> #include <linux/tty.h> -#include <linux/bootmem.h> #include <linux/seq_file.h> #include <linux/root_dev.h> #include <linux/cpu.h>
arch/powerpc/mm/init_32.c +0 -1
@@ -26,7 +26,6 @@#include <linux/mm.h> #include <linux/stddef.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/initrd.h> #include <linux/pagemap.h>
arch/powerpc/mm/pgtable_64.c +0 -1
@@ -33,7 +33,6 @@#include <linux/swap.h> #include <linux/stddef.h> #include <linux/vmalloc.h> -#include <linux/bootmem.h> #include <linux/memblock.h> #include <linux/slab.h>
PATCH 4/5 powerpc: Move sparse_init() into initmem_init
In reply to Anton BlanchardWe did part of sparse initialisation in setup_arch and part in initmem_init. Put them together.
---
arch/powerpc/kernel/setup_64.c +0 -1
@@ -678,7 +678,6 @@ void __init setup_arch(char **cmdline_p)emergency_stack_init ();initmem_init (); -sparse_init ();#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;
arch/powerpc/mm/mem.c +1 -0
@@ -194,6 +194,7 @@ void __init initmem_init(void)/* XXX need to clip this if using highmem? */ sparse_memory_present_with_active_regions (0 ); +sparse_init (); }/* mark pages that don't exist as nosave */
arch/powerpc/mm/numa.c +2 -0
@@ -957,6 +957,8 @@ void __init initmem_init(void)sparse_memory_present_with_active_regions (nid); } +sparse_init (); +setup_node_to_cpumask_map ();reset_numa_cpu_lookup_table ();
PATCH 5/5 powerpc: make __ffs return unsigned long
In reply to Anton BlanchardI'm seeing a build warning in mm/nobootmem.c after removing bootmem:
mm/nobootmem.c: In function '__free_pages_memory':include/linux/kernel.h:713:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void) (&_min1 == &_min2); \
^
mm/nobootmem.c:90:11: note: in expansion of macro 'min'
order = min(MAX_ORDER - 1UL, __ffs(start));
^The rest of the worlds seems to define __ffs as returning unsigned long, so lets do that.
---
arch/powerpc/include/asm/bitops.h +1 -1
@@ -213,7 +213,7 @@ static __inline__ unsigned long ffz(unsireturn __ilog2 (x & -x); } -static __inline__int __ffs (unsigned long x) +static __inline__unsigned long __ffs (unsigned long x) {return __ilog2 (x & -x); }
arch/powerpc/sysdev/fsl_pci.c +1 -1
@@ -152,7 +152,7 @@ static int setup_one_atmu(struct ccsr_pc flags |=0x10000000 ;/* enable relaxed ordering */ for (i =0 ; size >0 ; i++) { -unsigned int bits =min (ilog2 (size), +unsigned int bits =min_t (u32,ilog2 (size),__ffs (pci_addr | phys_addr));if (index + i >=5 )