Re: [RFC PATCH RESEND 02/10] scbed/fair: Remove duplicate check for busiest_cpu in active_load_balance_cpu_stop()
From: Xin Zhao
Date: Thu Sep 10 2026 - 20:32:03 EST
On Thu, 10 Sep 2026 14:41:09 +0300 Kayra Cizmeci <kayracizmeci@xxxxxxxxx> wrote:
> > The check for cpu_active(busiest_cpu) already ensures that busiest_cpu has
> > not gone down. An additional check for busiest_cpu != smp_processor_id()
> > is redundant. After this modification, busiest_cpu will no longer be bound
> > to smp_processor_id(), allowing the active_load_balance_cpu_stop function
> > to accommodate more scenarios, such as preempt active balancing feature
> > that will be addressed in later patches.
>
> The code is complicated and I usually not come near here.
>
> But how did you reach the conclusion of smp_processor_id() check is redundant?
>
> The cpu_active(busiest_cpu) just looks at the CPU mask of the given CPU or busiest in our case.
> But smp_processor_id() doesn't performs the same checks. And even if it's doing the same checks,
> how are you ensuring that it looks to the busiest CPU without even getting any parameters?
>
> For your conclusion to be right, the busiest CPU must be the CPU that smp_processor_id() looks
> and the cpu_active(busiest_cpu), smp_processor_id() needs to behave the same.
>
> And please add some details to the commit message why smp_processor_id() is redundant rather than
> skipping what smp_processor_id() does in any case.
>
> Please notify me if I'm wrong :_:
The active_load_balance_cpu_stop() is executed on the CPU busiest_cpu where the
stop task is dispatched. Therefore, unless it is during a special time when the
CPU is offline, busiest_cpu is always equal to smp_processor_id()`.
--
Xin Zhao