Re: [PATCH 3/3] sched: Use cpu_dying() to fix balance_push vs hotplug-rollback

From: Peter Zijlstra
Date: Thu Mar 11 2021 - 11:44:37 EST


On Thu, Mar 11, 2021 at 03:13:04PM +0000, Valentin Schneider wrote:

> > #ifdef CONFIG_SCHED_SMT
> > /*
> > * When going down, decrement the number of cores with SMT present.
>
> > @@ -8206,7 +8212,7 @@ void __init sched_init(void)
> > rq->sd = NULL;
> > rq->rd = NULL;
> > rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE;
> > - rq->balance_callback = NULL;
> > + rq->balance_callback = &balance_push_callback;
> > rq->active_balance = 0;
> > rq->next_balance = jiffies;
> > rq->push_cpu = 0;
> > @@ -8253,6 +8259,7 @@ void __init sched_init(void)
> >
> > #ifdef CONFIG_SMP
> > idle_thread_set_boot_cpu();
> > + balance_push_set(smp_processor_id(), false);
> > #endif
> > init_sched_fair_class();
> >
>
> I don't get what these two changes do - the end result is the same as
> before, no?

IIRC the idea was to initialize the offline CPUs to the same state as if
they'd been offlined.