Re: [PATCH] sched/fair: reduce false sharing on sched_balance_running

From: Eric Dumazet
Date: Fri Apr 25 2025 - 12:15:31 EST


On Fri, Apr 25, 2025 at 9:05 AM Shrikanth Hegde <sshegde@xxxxxxxxxxxxx> wrote:
>
>
>
> On 4/23/25 23:16, Eric Dumazet wrote:
> > rebalance_domains() can attempt to change sched_balance_running
> > more than 350,000 times per second on our servers.
> >
> > If sched_clock_irqtime and sched_balance_running share the
> > same cache line, we see a very high cost on hosts with 480 threads
> > dealing with many interrupts.
> >
> > This patch only acquires sched_balance_running when sd->last_balance
> > is old enough.
> >
> > It also moves sched_balance_running into a dedicated cache line on SMP.
> >
> > Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
> > Cc: Yafang Shao <laoar.shao@xxxxxxxxx>
> > Cc: Sean Christopherson <seanjc@xxxxxxxxxx>
> > Cc: Josh Don <joshdon@xxxxxxxxxx>
> > ---
>
> Hi Eric.
>
> Please check this thread which does the same thing AFAIU.
> https://lore.kernel.org/all/20250416035823.1846307-1-tim.c.chen@xxxxxxxxxxxxxxx/

Ah perfect, can we get this merged ?

>
> You could also try:
> https://lore.kernel.org/all/82baaf6c-f3d9-4c3e-be69-24389eadb18c@xxxxxxxxxxxxx/
>
> Thanks
>