From: Atish Patra Date: Thu, 15 Sep 2016 20:54:41 +0000 (-0600) Subject: sparc64: Fix irq stack bootmem allocation. X-Git-Tag: v4.1.12-92~30^2~19 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d1949cff6943e87cd1a18374473850be0ede9f8f;p=users%2Fjedix%2Flinux-maple.git sparc64: Fix irq stack bootmem allocation. Currently, irq stack bootmem is allocated for all possible cpus before nr_cpus value changes the list of possible cpus. As a result, there is unnecessary wastage of bootmemory. Move the irq stack bootmem allocation so that it happens after possible cpu list is modified based on nr_cpus value. Orabug: 23050718 Signed-off-by: Atish Patra Reviewed-by: Bob Picco Reviewed-by: Vijay Kumar (cherry picked from commit d192d0743aa6dbca0991900c490c06111b4bd86c) Signed-off-by: Allen Pais --- diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index e366d52f0858a..e68e4e83ffdce 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,8 @@ #include #include #include +#include +#include #ifdef CONFIG_IP_PNP #include @@ -594,6 +597,22 @@ static void __init init_sparc64_elf_hwcap(void) pause_patch(); } +void __init alloc_irqstack_bootmem(void) +{ + unsigned int i, node; + + for_each_possible_cpu(i) { + node = cpu_to_node(i); + + softirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), + THREAD_SIZE, + THREAD_SIZE, 0); + hardirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), + THREAD_SIZE, + THREAD_SIZE, 0); + } +} + void __init setup_arch(char **cmdline_p) { /* Initialize PROM console and command line. */ @@ -655,6 +674,12 @@ void __init setup_arch(char **cmdline_p) paging_init(); init_sparc64_elf_hwcap(); smp_fill_in_cpu_possible_map(); + /* + * Once the OF device tree and MDESC have been setup and nr_cpus has + * been parsed, we know the list of possible cpus. Therefore we can + * allocate the IRQ stacks. + */ + alloc_irqstack_bootmem(); } extern int stop_a_enabled; diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 8b20819ae99ee..556ee725a17c7 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2537,7 +2537,6 @@ void __init paging_init(void) { unsigned long end_pfn, shift, phys_base, phys_end; unsigned long real_end, i; - int node; setup_page_offset(); @@ -2738,21 +2737,6 @@ void __init paging_init(void) /* Setup bootmem... */ last_valid_pfn = end_pfn = bootmem_init(phys_base); - /* Once the OF device tree and MDESC have been setup, we know - * the list of possible cpus. Therefore we can allocate the - * IRQ stacks. - */ - for_each_possible_cpu(i) { - node = cpu_to_node(i); - - softirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), - THREAD_SIZE, - THREAD_SIZE, 0); - hardirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), - THREAD_SIZE, - THREAD_SIZE, 0); - } - kernel_physical_mapping_init(); {