Re: [PATCH 2/4] sched/fair: Small cleanup to sched_balance_newidle()
From: Shrikanth Hegde
Date: Wed Nov 12 2025 - 09:37:49 EST
On 11/7/25 9:36 PM, Peter Zijlstra wrote:
Pull out the !sd check to simplify code.
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
kernel/sched/fair.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12811,14 +12811,16 @@ static int sched_balance_newidle(struct
rcu_read_lock();
sd = rcu_dereference_check_sched_domain(this_rq->sd);
+ if (!sd) {
+ rcu_read_unlock();
+ goto out;
+ }
when is sd null? on isol_cpus ?
if sd is null, i think we are skipping these compared to earlier.
t0 = sched_clock_cpu(this_cpu);
sched_balance_update_blocked_averages(this_cpu);
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();