Re: [PATCH 2/4] sched/fair: Small cleanup to sched_balance_newidle()

Peter Zijlstra
2025-11-12T14:43:00Z

On Wed, Nov 12, 2025 at 08:07:24PM +0530, Shrikanth Hegde wrote:
>
>
> On 11/7/25 9:36 PM, Peter Zijlstra wrote:
> > Pull out the !sd check to simplify code.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> > kernel/sched/fair.c | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -12811,14 +12811,16 @@ static int sched_balance_newidle(struct
> > rcu_read_lock();
> > sd = rcu_dereference_check_sched_domain(this_rq->sd);
> > + if (!sd) {
> > + rcu_read_unlock();
> > + goto out;
> > + }
>
> when is sd null? on isol_cpus ?

Yeah, partitions (cpuset/isol_cpus) but also spuriously during
domain-rebuild IIRC.

> if sd is null, i think we are skipping these compared to earlier.
>
> t0 = sched_clock_cpu(this_cpu);
> sched_balance_update_blocked_averages(this_cpu);

let me pull that sched_balance_update_blocked_averages() thing up a few
lines.

Thanks!