Skip to content

Commit

Permalink
MIPS: Allow __cpu_number_map to be larger than NR_CPUS
Browse files Browse the repository at this point in the history
In systems where the CPU id space is sparse, this allows a smaller
NR_CPUS to be chosen, thus keeping internal data structures smaller.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Carlos Munoz <cmunoz@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/17388/
[jhogan@kernel.org: Add depends on SMP to fix
 "warning: symbol value '' invalid for MIPS_NR_CPU_NR_MAP"]
Signed-off-by: James Hogan <jhogan@kernel.org>
  • Loading branch information
David Daney authored and James Hogan committed Nov 7, 2017
1 parent 239e14d commit 7820b84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,8 @@ config CAVIUM_OCTEON_SOC
select USE_OF
select ARCH_SPARSEMEM_ENABLE
select SYS_SUPPORTS_SMP
select NR_CPUS_DEFAULT_16
select NR_CPUS_DEFAULT_64
select MIPS_NR_CPU_NR_MAP_1024
select BUILTIN_DTB
select MTD_COMPLEX_MAPPINGS
select SYS_SUPPORTS_RELOCATABLE
Expand Down Expand Up @@ -2725,6 +2726,15 @@ config NR_CPUS
config MIPS_PERF_SHARED_TC_COUNTERS
bool

config MIPS_NR_CPU_NR_MAP_1024
bool

config MIPS_NR_CPU_NR_MAP
int
depends on SMP
default 1024 if MIPS_NR_CPU_NR_MAP_1024
default NR_CPUS if !MIPS_NR_CPU_NR_MAP_1024

#
# Timer Interrupt Frequency Configuration
#
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern cpumask_t cpu_foreign_map[];

/* Map from cpu id to sequential logical cpu number. This will only
not be idempotent when cpus failed to come on-line. */
extern int __cpu_number_map[NR_CPUS];
extern int __cpu_number_map[CONFIG_MIPS_NR_CPU_NR_MAP];
#define cpu_number_map(cpu) __cpu_number_map[cpu]

/* The reverse map from sequential logical cpu number to cpu id. */
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <asm/setup.h>
#include <asm/maar.h>

int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
int __cpu_number_map[CONFIG_MIPS_NR_CPU_NR_MAP]; /* Map physical to logical */
EXPORT_SYMBOL(__cpu_number_map);

int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
Expand Down

0 comments on commit 7820b84

Please sign in to comment.