Skip to content

Commit c7ca7e0

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) <[email protected]> Reviewed-by: Dietmar Eggemann <[email protected]> Tested-by: Dietmar Eggemann <[email protected]> Tested-by: Chris Mason <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f1a77df commit c7ca7e0

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

1278812788
rcu_read_lock();
1278912789
sd = rcu_dereference_check_sched_domain(this_rq->sd);
12790+
if (!sd) {
12791+
rcu_read_unlock();
12792+
goto out;
12793+
}
1279012794

1279112795
if (!get_rd_overloaded(this_rq->rd) ||
12792-
(sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) {
12796+
this_rq->avg_idle < sd->max_newidle_lb_cost) {
1279312797

12794-
if (sd)
12795-
update_next_balance(sd, &next_balance);
12798+
update_next_balance(sd, &next_balance);
1279612799
rcu_read_unlock();
12797-
1279812800
goto out;
1279912801
}
1280012802
rcu_read_unlock();

0 commit comments

Comments
 (0)