]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched/fair: Small cleanup to sched_balance_newidle()
authorPeter Zijlstra <peterz@infradead.org>
Fri, 7 Nov 2025 16:01:24 +0000 (17:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Jan 2026 14:26:19 +0000 (15:26 +0100)
commit e78e70dbf603c1425f15f32b455ca148c932f6c1 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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/sched/fair.c

index bfce451f1210ce394266e6aabdcc7591aa0fca84..3dd12dcf6e6d1df8e33c6ce2e995378121d4eb4f 100644 (file)
@@ -12787,14 +12787,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();