mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
lib/cpumask: reorganize cpumask_local_spread() logic
Now after moving all NUMA logic into sched_numa_find_nth_cpu(), else-branch of cpumask_local_spread() is just a function call, and we can simplify logic by using ternary operator. While here, replace BUG() with WARN_ON(). Signed-off-by: Yury Norov <yury.norov@gmail.com> Acked-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Peter Lafreniere <peter@n8pjl.ca> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
406d394abf
commit
b1beed72b8
1 changed files with 6 additions and 10 deletions
|
@ -127,16 +127,12 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
|
||||||
/* Wrap: we always want a cpu. */
|
/* Wrap: we always want a cpu. */
|
||||||
i %= num_online_cpus();
|
i %= num_online_cpus();
|
||||||
|
|
||||||
if (node == NUMA_NO_NODE) {
|
cpu = (node == NUMA_NO_NODE) ?
|
||||||
cpu = cpumask_nth(i, cpu_online_mask);
|
cpumask_nth(i, cpu_online_mask) :
|
||||||
if (cpu < nr_cpu_ids)
|
sched_numa_find_nth_cpu(cpu_online_mask, i, node);
|
||||||
return cpu;
|
|
||||||
} else {
|
WARN_ON(cpu >= nr_cpu_ids);
|
||||||
cpu = sched_numa_find_nth_cpu(cpu_online_mask, i, node);
|
return cpu;
|
||||||
if (cpu < nr_cpu_ids)
|
|
||||||
return cpu;
|
|
||||||
}
|
|
||||||
BUG();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cpumask_local_spread);
|
EXPORT_SYMBOL(cpumask_local_spread);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue