Re: [PATCH] sched/fair: Optimize CPU iteration using for_each_cpu_and[not]

From: Valentin Schneider
Date: Tue Aug 19 2025 - 07:48:27 EST


On 15/08/25 09:15, lirongqing wrote:
> From: Li RongQing <lirongqing@xxxxxxxxx>
>
> Replace open-coded CPU iteration patterns with more efficient
> for_each_cpu_and() and for_each_cpu_andnot() macros in three locations.
>
> This change both simplifies the code and provides minor performance
> improvements by using the more specialized iteration macros.
>

TBF I'm not sure it does improve anything for the SMT cases considering we
don't see much more than SMT8.

The task_numa_find_cpu() one I do agree makes things better.

> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>

Reviewed-by: Valentin Schneider <vschneid@xxxxxxxxxx>