From: Peter Zijlstra Date: Fri, 7 Nov 2025 16:01:24 +0000 (+0100) Subject: sched/fair: Small cleanup to sched_balance_newidle() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e78e70dbf603c1425f15f32b455ca148c932f6c1;p=thirdparty%2Flinux.git sched/fair: Small cleanup to sched_balance_newidle() Pull out the !sd check to simplify code. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dietmar Eggemann Tested-by: Dietmar Eggemann Tested-by: Chris Mason Link: https://patch.msgid.link/20251107161739.525916173@infradead.org --- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b73af3783de41..75f891df4e5fb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12879,14 +12879,16 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf) rcu_read_lock(); sd = rcu_dereference_check_sched_domain(this_rq->sd); + if (!sd) { + rcu_read_unlock(); + goto out; + } if (!get_rd_overloaded(this_rq->rd) || - (sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) { + this_rq->avg_idle < sd->max_newidle_lb_cost) { - if (sd) - update_next_balance(sd, &next_balance); + update_next_balance(sd, &next_balance); rcu_read_unlock(); - goto out; } rcu_read_unlock();