Skip to content

Commit 52aa889

Browse files
Peter Zijlstragregkh
authored andcommitted
sched/fair: Small cleanup to sched_balance_newidle()
commit e78e70d upstream. Pull out the !sd check to simplify code. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Tested-by: Chris Mason <clm@meta.com> Link: https://patch.msgid.link/20251107161739.525916173@infradead.org [ Ajay: Modified to apply on v6.12 ] Signed-off-by: Ajay Kaher <ajay.kaher@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4888e1d commit 52aa889

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

kernel/sched/fair.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12864,14 +12864,16 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf)
1286412864

1286512865
rcu_read_lock();
1286612866
sd = rcu_dereference_check_sched_domain(this_rq->sd);
12867+
if (!sd) {
12868+
rcu_read_unlock();
12869+
goto out;
12870+
}
1286712871

1286812872
if (!get_rd_overloaded(this_rq->rd) ||
12869-
(sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) {
12873+
this_rq->avg_idle < sd->max_newidle_lb_cost) {
1287012874

12871-
if (sd)
12872-
update_next_balance(sd, &next_balance);
12875+
update_next_balance(sd, &next_balance);
1287312876
rcu_read_unlock();
12874-
1287512877
goto out;
1287612878
}
1287712879
rcu_read_unlock();

0 commit comments

Comments
 (0)