Skip to content

Commit e78e70d

Browse files
author
Peter Zijlstra
committed
sched/fair: Small cleanup to sched_balance_newidle()
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
1 parent d206fba commit e78e70d

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
@@ -12879,14 +12879,16 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf)
1287912879

1288012880
rcu_read_lock();
1288112881
sd = rcu_dereference_check_sched_domain(this_rq->sd);
12882+
if (!sd) {
12883+
rcu_read_unlock();
12884+
goto out;
12885+
}
1288212886

1288312887
if (!get_rd_overloaded(this_rq->rd) ||
12884-
(sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) {
12888+
this_rq->avg_idle < sd->max_newidle_lb_cost) {
1288512889

12886-
if (sd)
12887-
update_next_balance(sd, &next_balance);
12890+
update_next_balance(sd, &next_balance);
1288812891
rcu_read_unlock();
12889-
1289012892
goto out;
1289112893
}
1289212894
rcu_read_unlock();

0 commit comments

Comments
 (0)