Skip to content

Commit ebb99a4

Browse files
Atish Patradavem330
authored andcommitted
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>
1 parent 9b2f753 commit ebb99a4

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

arch/sparc/kernel/setup_64.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/initrd.h>
3232
#include <linux/module.h>
3333
#include <linux/start_kernel.h>
34+
#include <linux/bootmem.h>
3435

3536
#include <asm/io.h>
3637
#include <asm/processor.h>
@@ -50,6 +51,8 @@
5051
#include <asm/elf.h>
5152
#include <asm/mdesc.h>
5253
#include <asm/cacheflush.h>
54+
#include <asm/dma.h>
55+
#include <asm/irq.h>
5356

5457
#ifdef CONFIG_IP_PNP
5558
#include <net/ipconfig.h>
@@ -590,6 +593,22 @@ static void __init init_sparc64_elf_hwcap(void)
590593
pause_patch();
591594
}
592595

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+
593612
void __init setup_arch(char **cmdline_p)
594613
{
595614
/* Initialize PROM console and command line. */
@@ -651,6 +670,12 @@ void __init setup_arch(char **cmdline_p)
651670
paging_init();
652671
init_sparc64_elf_hwcap();
653672
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();
654679
}
655680

656681
extern int stop_a_enabled;

arch/sparc/mm/init_64.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,6 @@ void __init paging_init(void)
20812081
{
20822082
unsigned long end_pfn, shift, phys_base;
20832083
unsigned long real_end, i;
2084-
int node;
20852084

20862085
setup_page_offset();
20872086

@@ -2250,21 +2249,6 @@ void __init paging_init(void)
22502249
/* Setup bootmem... */
22512250
last_valid_pfn = end_pfn = bootmem_init(phys_base);
22522251

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-
22682252
kernel_physical_mapping_init();
22692253

22702254
{

0 commit comments

Comments
 (0)