Messages in this thread Patch in this message | | | From | Yury Norov <> | Subject | [PATCH v3 7/7] lib/group_cpus: simplify grp_spread_init_one() for more | Date | Mon, 11 Dec 2023 20:21:07 -0800 |
| |
The outer and inner loops of grp_spread_init_one() do the same thing - move a bit from nmsk to irqmsk.
The inner loop iterates the sibling group, which includes the CPU picked by outer loop. And it means that we can drop the part that moves the bit in the outer loop.
Signed-off-by: Yury Norov <yury.norov@gmail.com> --- lib/group_cpus.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/group_cpus.c b/lib/group_cpus.c index 664a56171a1b..7aa7a6289355 100644 --- a/lib/group_cpus.c +++ b/lib/group_cpus.c @@ -18,14 +18,8 @@ static void grp_spread_init_one(struct cpumask *irqmsk, struct cpumask *nmsk, int cpu, sibl; for_each_cpu(cpu, nmsk) { - __cpumask_clear_cpu(cpu, nmsk); - __cpumask_set_cpu(cpu, irqmsk); - if (cpus_per_grp-- == 0) - return; - - /* If the cpu has siblings, use them first */ siblmsk = topology_sibling_cpumask(cpu); - sibl = cpu + 1; + sibl = cpu; for_each_cpu_and_from(sibl, siblmsk, nmsk) { __cpumask_clear_cpu(sibl, nmsk); -- 2.40.1
| |