Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/xmon: simplify xmon_batch_next_cpu()

The function opencodes for_each_cpu_wrap() macro. As a loop termination
condition it uses cpumask_empty(), which is O(N), and it makes the whole
algorithm O(N^2). Switching to for_each_cpu_wrap() simplifies the logic,
and makes the algorithm linear.

Signed-off-by: Yury Norov <yury.norov@gmail.com>

+1 -5
+1 -5
arch/powerpc/xmon/xmon.c
··· 1271 1271 { 1272 1272 unsigned long cpu; 1273 1273 1274 - while (!cpumask_empty(&xmon_batch_cpus)) { 1275 - cpu = cpumask_next_wrap(smp_processor_id(), &xmon_batch_cpus, 1276 - xmon_batch_start_cpu, true); 1277 - if (cpu >= nr_cpu_ids) 1278 - break; 1274 + for_each_cpu_wrap(cpu, &xmon_batch_cpus, xmon_batch_start_cpu) { 1279 1275 if (xmon_batch_start_cpu == -1) 1280 1276 xmon_batch_start_cpu = cpu; 1281 1277 if (xmon_switch_cpu(cpu))