]> 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:25:21 +0000 (15:25 +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
[ 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>
kernel/sched/fair.c

index 22dc54aab8dd63c13d3c3959745e3cb34f740b7f..8a46cac2f7f8fc30070521ff27ca042686087cd2 100644 (file)
@@ -12864,14 +12864,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();