From: brookxu <brookxu.cn@gmail.com>
To: paolo.valente@linaro.org, axboe@kernel.dk, tj@kernel.org
Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 4/8] bfq: expire bfqq if a higher priority class is waiting
Date: Mon, 8 Mar 2021 20:00:17 +0800 [thread overview]
Message-ID: <055c82a8f016a0e918e69ac6700a5839a7f4bfaf.1615203034.git.brookxu@tencent.com> (raw)
In-Reply-To: <cover.1615203034.git.brookxu@tencent.com>
In-Reply-To: <cover.1615203034.git.brookxu@tencent.com>
From: Chunguang Xu <brookxu@tencent.com>
From: Chunguang Xu <brookxu@tencent.com>
Expire bfqq If a higher priority class is waiting to be served, we
can further guarantee the delay of the higher priority class.
Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
block/bfq-iosched.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index b639cdbb4192..223affaa7c92 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4677,7 +4677,10 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
struct bfq_queue *bfqq)
{
struct request *rq = bfqq->next_rq;
+ struct bfq_sched_data *sd = bfqq->entity.sched_data;
+ struct bfq_service_tree *st = sd->service_tree;
unsigned long service_to_charge;
+ int idx;
service_to_charge = bfq_serv_to_charge(rq, bfqq);
@@ -4714,6 +4717,17 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
if (!(bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq)))
goto return_rq;
+ /*
+ * Expire bfqq, if other queues belong to higher priority
+ * class are waiting for service.
+ */
+ for (idx = bfqq->ioprio_class - 2; idx >= 0; idx--) {
+ if (!RB_EMPTY_ROOT(&(st + idx)->active))
+ break;
+ }
+ if (idx < 0)
+ goto return_rq;
+
bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);
return_rq:
--
2.30.0
next prev parent reply other threads:[~2021-03-08 12:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 12:00 [RFC PATCH 0/8] bfq: introduce bfq.ioprio for cgroup brookxu
2021-03-08 12:00 ` [RFC PATCH 1/8] bfq: introduce bfq_entity_to_bfqg helper method brookxu
2021-03-08 12:00 ` [RFC PATCH 2/8] bfq: limit the IO depth of idle_class to 1 brookxu
2021-03-08 12:00 ` [RFC PATCH 3/8] bfq: keep the minimun bandwidth for be_class brookxu
2021-03-08 12:00 ` brookxu [this message]
2021-03-08 12:00 ` [RFC PATCH 5/8] bfq: introduce bfq.ioprio for cgroup brookxu
2021-03-08 12:00 ` [RFC PATCH 6/8] bfq: convert the type of bfq_group.bfqd to bfq_data* brookxu
2021-03-08 12:00 ` [RFC PATCH 7/8] bfq: remove unnecessary initialization logic brookxu
2021-03-08 12:00 ` [RFC PATCH 8/8] bfq: optimize the calculation of bfq_weight_to_ioprio() brookxu
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=055c82a8f016a0e918e69ac6700a5839a7f4bfaf.1615203034.git.brookxu@tencent.com \
--to=brookxu.cn@gmail.com \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paolo.valente@linaro.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).