Re: [RESEND] sched/rt: Skip currently executing CPU in rto_next_cpu()
From: K Prateek Nayak
Date: Tue Jan 06 2026 - 03:43:13 EST
Hello Chen, Steve,
On 1/5/2026 9:10 AM, Chen Jinghuang wrote:
> @@ -2118,10 +2119,13 @@ static int rto_next_cpu(struct root_domain *rd)
> */
> for (;;) {
>
> - /* When rto_cpu is -1 this acts like cpumask_first() */
> - cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
> + do {
> + /* When rto_cpu is -1 this acts like cpumask_first() */
> + cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
>
> - rd->rto_cpu = cpu;
> + rd->rto_cpu = cpu;
> + /* Do not send IPI to self */
> + } while (cpu == this_cpu);
nit.
Since we are already within an infinite for-loop, can't we simply do:
/* Do not send IPI to self */
if (cpu == this_cpu)
continue;
here and go evaluate cpumask_next() again instead of adding another
do-while? Was the nested loop intentional to highlight these bits
explicitly?
>
> if (cpu < nr_cpu_ids)
> return cpu;
--
Thanks and Regards,
Prateek