From: Tao Zhou <tao.zhou@linux.dev>
To: linux-kernel@vger.kernel.org, tao.zhou@linux.dev
Subject: [PATCH] sched/fair: Minor making update_blocked_load_status() be able to set has_blocked_load to 1
Date: Mon, 4 Apr 2022 00:33:38 +0800 [thread overview]
Message-ID: <20220403163338.6341-1-tao.zhou@linux.dev> (raw)
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;
}
#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
--
2.35.1
reply other threads:[~2022-04-03 16:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220403163338.6341-1-tao.zhou@linux.dev \
--to=tao.zhou@linux.dev \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox