Commit 6e086302 authored by Srikar Dronamraju's avatar Srikar Dronamraju Committed by Michael Ellerman

powerpc/smp: Allocate cpumask only after searching thread group

If allocated earlier and the search fails, then cpu_l1_cache_map cpumask
is unnecessarily cleared. However cpu_l1_cache_map can be allocated /
cleared after we search thread group.

Please note CONFIG_CPUMASK_OFFSTACK is not set on Powerpc. Hence cpumask
allocated by zalloc_cpumask_var_node is never freed.
Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Reviewed-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200810071834.92514-9-srikar@linux.vnet.ibm.com
parent f9f130ff
...@@ -790,10 +790,6 @@ static int init_cpu_l1_cache_map(int cpu) ...@@ -790,10 +790,6 @@ static int init_cpu_l1_cache_map(int cpu)
if (err) if (err)
goto out; goto out;
zalloc_cpumask_var_node(&per_cpu(cpu_l1_cache_map, cpu),
GFP_KERNEL,
cpu_to_node(cpu));
cpu_group_start = get_cpu_thread_group_start(cpu, &tg); cpu_group_start = get_cpu_thread_group_start(cpu, &tg);
if (unlikely(cpu_group_start == -1)) { if (unlikely(cpu_group_start == -1)) {
...@@ -802,6 +798,9 @@ static int init_cpu_l1_cache_map(int cpu) ...@@ -802,6 +798,9 @@ static int init_cpu_l1_cache_map(int cpu)
goto out; goto out;
} }
zalloc_cpumask_var_node(&per_cpu(cpu_l1_cache_map, cpu),
GFP_KERNEL, cpu_to_node(cpu));
for (i = first_thread; i < first_thread + threads_per_core; i++) { for (i = first_thread; i < first_thread + threads_per_core; i++) {
int i_group_start = get_cpu_thread_group_start(i, &tg); int i_group_start = get_cpu_thread_group_start(i, &tg);
......
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