diff options
author | Atish Patra <atish.patra@oracle.com> | 2016-09-15 16:54:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-28 11:24:03 -0400 |
commit | ebb99a4c12e4daabe1940ae936e8e7e97ae68c6f (patch) | |
tree | e857fbe7a91bb78022da0b9c1abee53ffa06c6df | |
parent | 9b2f753ec23710aa32c0d837d2499db92fe9115b (diff) |
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.
Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Bob Picco <bob.picco@oracle.com>
Reviewed-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/kernel/setup_64.c | 25 | ||||
-rw-r--r-- | arch/sparc/mm/init_64.c | 16 |
2 files changed, 25 insertions, 16 deletions
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index f32cfe83dfd1..6b7331d198e9 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/start_kernel.h> | 33 | #include <linux/start_kernel.h> |
34 | #include <linux/bootmem.h> | ||
34 | 35 | ||
35 | #include <asm/io.h> | 36 | #include <asm/io.h> |
36 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
@@ -50,6 +51,8 @@ | |||
50 | #include <asm/elf.h> | 51 | #include <asm/elf.h> |
51 | #include <asm/mdesc.h> | 52 | #include <asm/mdesc.h> |
52 | #include <asm/cacheflush.h> | 53 | #include <asm/cacheflush.h> |
54 | #include <asm/dma.h> | ||
55 | #include <asm/irq.h> | ||
53 | 56 | ||
54 | #ifdef CONFIG_IP_PNP | 57 | #ifdef CONFIG_IP_PNP |
55 | #include <net/ipconfig.h> | 58 | #include <net/ipconfig.h> |
@@ -590,6 +593,22 @@ static void __init init_sparc64_elf_hwcap(void) | |||
590 | pause_patch(); | 593 | pause_patch(); |
591 | } | 594 | } |
592 | 595 | ||
596 | void __init alloc_irqstack_bootmem(void) | ||
597 | { | ||
598 | unsigned int i, node; | ||
599 | |||
600 | for_each_possible_cpu(i) { | ||
601 | node = cpu_to_node(i); | ||
602 | |||
603 | softirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), | ||
604 | THREAD_SIZE, | ||
605 | THREAD_SIZE, 0); | ||
606 | hardirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), | ||
607 | THREAD_SIZE, | ||
608 | THREAD_SIZE, 0); | ||
609 | } | ||
610 | } | ||
611 | |||
593 | void __init setup_arch(char **cmdline_p) | 612 | void __init setup_arch(char **cmdline_p) |
594 | { | 613 | { |
595 | /* Initialize PROM console and command line. */ | 614 | /* Initialize PROM console and command line. */ |
@@ -651,6 +670,12 @@ void __init setup_arch(char **cmdline_p) | |||
651 | paging_init(); | 670 | paging_init(); |
652 | init_sparc64_elf_hwcap(); | 671 | init_sparc64_elf_hwcap(); |
653 | smp_fill_in_cpu_possible_map(); | 672 | smp_fill_in_cpu_possible_map(); |
673 | /* | ||
674 | * Once the OF device tree and MDESC have been setup and nr_cpus has | ||
675 | * been parsed, we know the list of possible cpus. Therefore we can | ||
676 | * allocate the IRQ stacks. | ||
677 | */ | ||
678 | alloc_irqstack_bootmem(); | ||
654 | } | 679 | } |
655 | 680 | ||
656 | extern int stop_a_enabled; | 681 | extern int stop_a_enabled; |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 80031fc2e2d6..7ac6b62fb7c1 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -2081,7 +2081,6 @@ void __init paging_init(void) | |||
2081 | { | 2081 | { |
2082 | unsigned long end_pfn, shift, phys_base; | 2082 | unsigned long end_pfn, shift, phys_base; |
2083 | unsigned long real_end, i; | 2083 | unsigned long real_end, i; |
2084 | int node; | ||
2085 | 2084 | ||
2086 | setup_page_offset(); | 2085 | setup_page_offset(); |
2087 | 2086 | ||
@@ -2250,21 +2249,6 @@ void __init paging_init(void) | |||
2250 | /* Setup bootmem... */ | 2249 | /* Setup bootmem... */ |
2251 | last_valid_pfn = end_pfn = bootmem_init(phys_base); | 2250 | last_valid_pfn = end_pfn = bootmem_init(phys_base); |
2252 | 2251 | ||
2253 | /* Once the OF device tree and MDESC have been setup, we know | ||
2254 | * the list of possible cpus. Therefore we can allocate the | ||
2255 | * IRQ stacks. | ||
2256 | */ | ||
2257 | for_each_possible_cpu(i) { | ||
2258 | node = cpu_to_node(i); | ||
2259 | |||
2260 | softirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), | ||
2261 | THREAD_SIZE, | ||
2262 | THREAD_SIZE, 0); | ||
2263 | hardirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), | ||
2264 | THREAD_SIZE, | ||
2265 | THREAD_SIZE, 0); | ||
2266 | } | ||
2267 | |||
2268 | kernel_physical_mapping_init(); | 2252 | kernel_physical_mapping_init(); |
2269 | 2253 | ||
2270 | { | 2254 | { |