From: Chengming Zhou <zhouchengming@bytedance.com>
To: tj@kernel.org, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Chengming Zhou <zhouchengming@bytedance.com>
Subject: [PATCH 2/2] blk-iocost: only flush wait and indebt stat deltas when needed
Date: Wed, 1 Jun 2022 20:20:07 +0800 [thread overview]
Message-ID: <20220601122007.1057-2-zhouchengming@bytedance.com> (raw)
In-Reply-To: <20220601122007.1057-1-zhouchengming@bytedance.com>
We only need to flush wait and indebt stat deltas when the iocg
is in these status.
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
block/blk-iocost.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index b1f2305e8032..502425b44475 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2174,28 +2174,28 @@ static int ioc_check_iocgs(struct ioc *ioc, struct ioc_now *now)
spin_lock(&iocg->waitq.lock);
- /* flush wait and indebt stat deltas */
- if (iocg->wait_since) {
- iocg->stat.wait_us += now->now - iocg->wait_since;
- iocg->wait_since = now->now;
- }
- if (iocg->indebt_since) {
- iocg->stat.indebt_us +=
- now->now - iocg->indebt_since;
- iocg->indebt_since = now->now;
- }
- if (iocg->indelay_since) {
- iocg->stat.indelay_us +=
- now->now - iocg->indelay_since;
- iocg->indelay_since = now->now;
- }
-
if (waitqueue_active(&iocg->waitq) || iocg->abs_vdebt ||
iocg->delay) {
/* might be oversleeping vtime / hweight changes, kick */
iocg_kick_waitq(iocg, true, now);
if (iocg->abs_vdebt || iocg->delay)
nr_debtors++;
+
+ /* flush wait and indebt stat deltas */
+ if (iocg->wait_since) {
+ iocg->stat.wait_us += now->now - iocg->wait_since;
+ iocg->wait_since = now->now;
+ }
+ if (iocg->indebt_since) {
+ iocg->stat.indebt_us +=
+ now->now - iocg->indebt_since;
+ iocg->indebt_since = now->now;
+ }
+ if (iocg->indelay_since) {
+ iocg->stat.indelay_us +=
+ now->now - iocg->indelay_since;
+ iocg->indelay_since = now->now;
+ }
} else if (iocg_is_idle(iocg))
iocg_deactivate(iocg, now);
--
2.36.1
next prev parent reply other threads:[~2022-06-01 12:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-01 12:20 [PATCH 1/2] blk-iocost: factor out iocg_deactivate() Chengming Zhou
2022-06-01 12:20 ` Chengming Zhou [this message]
2022-06-01 16:23 ` [PATCH 2/2] blk-iocost: only flush wait and indebt stat deltas when needed Tejun Heo
2022-06-01 23:57 ` Chengming Zhou
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=20220601122007.1057-2-zhouchengming@bytedance.com \
--to=zhouchengming@bytedance.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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;
as well as URLs for NNTP newsgroup(s).