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

From: Tao Zhou
Date: Sun Apr 03 2022 - 12:33:39 EST

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(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5146163bfabb..fc8765792a77 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -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;
@@ -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