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.

sched_ext: idle: small CPU iteration refactoring

Replace the loop to check if all SMT CPUs are idle with
cpumask_subset(). This simplifies the code and slightly improves
efficiency, while preserving the original behavior.

Note that idle_masks.smt handling remains racy, which is acceptable as
it serves as an optimization and is self-correcting.

Suggested-and-reviewed-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Andrea Righi and committed by
Tejun Heo
d9071ecb c0cf3530

+2 -4
+2 -4
kernel/sched/ext.c
··· 3671 3671 * idle_masks.smt handling is racy but that's fine as 3672 3672 * it's only for optimization and self-correcting. 3673 3673 */ 3674 - for_each_cpu(cpu, smt) { 3675 - if (!cpumask_test_cpu(cpu, idle_masks.cpu)) 3676 - return; 3677 - } 3674 + if (!cpumask_subset(smt, idle_masks.cpu)) 3675 + return; 3678 3676 cpumask_or(idle_masks.smt, idle_masks.smt, smt); 3679 3677 } else { 3680 3678 cpumask_andnot(idle_masks.smt, idle_masks.smt, smt);