Skip to contentSkip to conversation

sched/fair: Minor making update_blocked_load_status() be able to set has_blocked_load to 1

PATCH New Tao Zhou 1 participant 1 message Apr 3, 2022 Scheduler

lore
Share & tools
lore

Tao Zhou

author
#0 lore raw

PATCH 1/1 sched/fair: Minor making update_blocked_load_status() be able to set has_blocked_load to 1

I realize that newidle_balance() can not set rq->has_blocked_load to 1 when it has block load. When no task pulled then nohz_newidle_balance() will set flag NOHZ_NEWILB_KICK to trigger ILB. In do_idle(), nohz_run_idle_balance() will call _nohz_idle_balance() to update status using update_nohz_stats() to make sure there has blocked load. If it is not set in newidle_balance(), update_nohz_stats() will exit early and do not do update_blocked_averages()(time spent from newidle_balance() to update_nohz_stats will not be used to update load avg). There has chance to call cpuidle_idle_call() to set has_blocked_load to 1 and can also update later but if cpuidle_idle_call() is not called, the lost update in nohz_run_idle_balance() will not be permitted that me not thoroughly think. I know this is likely a invalid commit log.

---
 kernel/sched/fair.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched/fair.c +4 -2
index 5146163bfabb..fc8765792a77 100644
@@ -8091,7 +8091,9 @@ static inline void update_blocked_load_tick(struct rq *rq)
 
 static inline void update_blocked_load_status(struct rq *rq, bool has_blocked)
 {
-	if (!has_blocked)
+	if (has_blocked)
+		rq->has_blocked_load = 1;
+	else
 		rq->has_blocked_load = 0;
 }
 #else
@@ -10597,7 +10599,7 @@ void nohz_balance_enter_idle(int cpu)
 	 * If a clear happens, it will have evaluated last additions because
 	 * rq->lock is held during the check and the clear
 	 */
-	rq->has_blocked_load = 1;
+	update_blocked_load_status(rq, 1);
 
 	/*
 	 * The tick is still stopped but load could have been added in the
Signature · 1 line
2.35.1