Commit 97fd6016 authored by Sudeep Holla's avatar Sudeep Holla Committed by Will Deacon

arm64: numa: separate out updates to percpu nodeid and NUMA node cpumap

Currently numa_clear_node removes both cpu information from the NUMA
node cpumap as well as the NUMA node id from the cpu. Similarly
numa_store_cpu_info updates both percpu nodeid and NUMA cpumap.

However we need to retain the numa node id for the cpu and only remove
the cpu information from the numa node cpumap during CPU hotplug out.
The same can be extended for hotplugging in the CPU.

This patch separates out numa_{add,remove}_cpu from numa_clear_node and
numa_store_cpu_info.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Reviewed-by: default avatarGanapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Tested-by: default avatarGanapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Tested-by: default avatarHanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 31b46035
...@@ -35,10 +35,14 @@ void __init numa_set_distance(int from, int to, int distance); ...@@ -35,10 +35,14 @@ void __init numa_set_distance(int from, int to, int distance);
void __init numa_free_distance(void); void __init numa_free_distance(void);
void __init early_map_cpu_to_node(unsigned int cpu, int nid); void __init early_map_cpu_to_node(unsigned int cpu, int nid);
void numa_store_cpu_info(unsigned int cpu); void numa_store_cpu_info(unsigned int cpu);
void numa_add_cpu(unsigned int cpu);
void numa_remove_cpu(unsigned int cpu);
#else /* CONFIG_NUMA */ #else /* CONFIG_NUMA */
static inline void numa_store_cpu_info(unsigned int cpu) { } static inline void numa_store_cpu_info(unsigned int cpu) { }
static inline void numa_add_cpu(unsigned int cpu) { }
static inline void numa_remove_cpu(unsigned int cpu) { }
static inline void arm64_numa_init(void) { } static inline void arm64_numa_init(void) { }
static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { } static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { }
......
...@@ -225,6 +225,7 @@ asmlinkage notrace void secondary_start_kernel(void) ...@@ -225,6 +225,7 @@ asmlinkage notrace void secondary_start_kernel(void)
notify_cpu_starting(cpu); notify_cpu_starting(cpu);
store_cpu_topology(cpu); store_cpu_topology(cpu);
numa_add_cpu(cpu);
/* /*
* OK, now it's safe to let the boot CPU continue. Wait for * OK, now it's safe to let the boot CPU continue. Wait for
...@@ -679,6 +680,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) ...@@ -679,6 +680,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
this_cpu = smp_processor_id(); this_cpu = smp_processor_id();
store_cpu_topology(this_cpu); store_cpu_topology(this_cpu);
numa_store_cpu_info(this_cpu); numa_store_cpu_info(this_cpu);
numa_add_cpu(this_cpu);
/* /*
* If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set
......
...@@ -70,19 +70,32 @@ EXPORT_SYMBOL(cpumask_of_node); ...@@ -70,19 +70,32 @@ EXPORT_SYMBOL(cpumask_of_node);
#endif #endif
static void map_cpu_to_node(unsigned int cpu, int nid) static void numa_update_cpu(unsigned int cpu, bool remove)
{ {
set_cpu_numa_node(cpu, nid); int nid = cpu_to_node(cpu);
if (nid >= 0)
if (nid == NUMA_NO_NODE)
return;
if (remove)
cpumask_clear_cpu(cpu, node_to_cpumask_map[nid]);
else
cpumask_set_cpu(cpu, node_to_cpumask_map[nid]); cpumask_set_cpu(cpu, node_to_cpumask_map[nid]);
} }
void numa_clear_node(unsigned int cpu) void numa_add_cpu(unsigned int cpu)
{ {
int nid = cpu_to_node(cpu); numa_update_cpu(cpu, false);
}
if (nid >= 0) void numa_remove_cpu(unsigned int cpu)
cpumask_clear_cpu(cpu, node_to_cpumask_map[nid]); {
numa_update_cpu(cpu, true);
}
void numa_clear_node(unsigned int cpu)
{
numa_remove_cpu(cpu);
set_cpu_numa_node(cpu, NUMA_NO_NODE); set_cpu_numa_node(cpu, NUMA_NO_NODE);
} }
...@@ -116,7 +129,7 @@ static void __init setup_node_to_cpumask_map(void) ...@@ -116,7 +129,7 @@ static void __init setup_node_to_cpumask_map(void)
*/ */
void numa_store_cpu_info(unsigned int cpu) void numa_store_cpu_info(unsigned int cpu)
{ {
map_cpu_to_node(cpu, cpu_to_node_map[cpu]); set_cpu_numa_node(cpu, cpu_to_node_map[cpu]);
} }
void __init early_map_cpu_to_node(unsigned int cpu, int nid) void __init early_map_cpu_to_node(unsigned int cpu, int nid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment