public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Paolo Valente <paolo.valente@linaro.org>
Cc: linux-block@vger.kernel.org, "Jens Axboe" <axboe@kernel.dk>,
	"Michal Koutný" <mkoutny@suse.com>, "Jan Kara" <jack@suse.cz>
Subject: [PATCH 3/8] bfq: Store full bitmap depth in bfq_data
Date: Wed,  6 Oct 2021 19:31:42 +0200	[thread overview]
Message-ID: <20211006173157.6906-3-jack@suse.cz> (raw)
In-Reply-To: <20211006164110.10817-1-jack@suse.cz>

Store bitmap depth shift inside bfq_data so that we can use it in
bfq_limit_depth() for proportioning when limiting number of available
request tags for a cgroup.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 block/bfq-iosched.c | 10 ++++++----
 block/bfq-iosched.h |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 4d9e04edb614..c93a74b8e9c8 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -6855,7 +6855,9 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
 				      struct sbitmap_queue *bt)
 {
 	unsigned int i, j, min_shallow = UINT_MAX;
+	unsigned int depth = 1U << bt->sb.shift;
 
+	bfqd->full_depth_shift = bt->sb.shift;
 	/*
 	 * In-word depths if no bfq_queue is being weight-raised:
 	 * leaving 25% of tags only for sync reads.
@@ -6867,13 +6869,13 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
 	 * limit 'something'.
 	 */
 	/* no more than 50% of tags for async I/O */
-	bfqd->word_depths[0][0] = max((1U << bt->sb.shift) >> 1, 1U);
+	bfqd->word_depths[0][0] = max(depth >> 1, 1U);
 	/*
 	 * no more than 75% of tags for sync writes (25% extra tags
 	 * w.r.t. async I/O, to prevent async I/O from starving sync
 	 * writes)
 	 */
-	bfqd->word_depths[0][1] = max(((1U << bt->sb.shift) * 3) >> 2, 1U);
+	bfqd->word_depths[0][1] = max((depth * 3) >> 2, 1U);
 
 	/*
 	 * In-word depths in case some bfq_queue is being weight-
@@ -6883,9 +6885,9 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
 	 * shortage.
 	 */
 	/* no more than ~18% of tags for async I/O */
-	bfqd->word_depths[1][0] = max(((1U << bt->sb.shift) * 3) >> 4, 1U);
+	bfqd->word_depths[1][0] = max((depth * 3) >> 4, 1U);
 	/* no more than ~37% of tags for sync writes (~20% extra tags) */
-	bfqd->word_depths[1][1] = max(((1U << bt->sb.shift) * 6) >> 4, 1U);
+	bfqd->word_depths[1][1] = max((depth * 6) >> 4, 1U);
 
 	for (i = 0; i < 2; i++)
 		for (j = 0; j < 2; j++)
diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
index 3787cfb0febb..820cb8c2d1fe 100644
--- a/block/bfq-iosched.h
+++ b/block/bfq-iosched.h
@@ -769,6 +769,7 @@ struct bfq_data {
 	 * function)
 	 */
 	unsigned int word_depths[2][2];
+	unsigned int full_depth_shift;
 };
 
 enum bfqq_state_flags {
-- 
2.26.2


  parent reply	other threads:[~2021-10-06 17:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 17:31 [PATCH 0/8 v3] bfq: Limit number of allocated scheduler tags per cgroup Jan Kara
2021-10-06 17:31 ` [PATCH 1/8] block: Provide icq in request allocation data Jan Kara
2021-10-06 17:31 ` [PATCH 2/8] bfq: Track number of allocated requests in bfq_entity Jan Kara
2021-10-06 17:31 ` Jan Kara [this message]
2021-10-06 17:31 ` [PATCH 4/8] bfq: Limit number of requests consumed by each cgroup Jan Kara
2021-11-02 18:16   ` Michal Koutný
2021-11-03 13:03     ` Jan Kara
2021-11-03 18:12       ` Michal Koutný
2021-11-04 11:20         ` Jan Kara
2021-10-06 17:31 ` [PATCH 5/8] bfq: Limit waker detection in time Jan Kara
2021-10-06 17:31 ` [PATCH 6/8] bfq: Provide helper to generate bfqq name Jan Kara
2021-10-06 17:31 ` [PATCH 7/8] bfq: Log waker detections Jan Kara
2021-10-06 17:31 ` [PATCH 8/8] bfq: Do not let waker requests skip proper accounting Jan Kara
2021-10-07 16:33 ` [PATCH 0/8 v3] bfq: Limit number of allocated scheduler tags per cgroup Paolo Valente
2021-10-25  7:58   ` Paolo Valente
2021-10-25 11:14     ` Jan Kara
2021-11-10 10:24       ` Paolo Valente
  -- strict thread matches above, loose matches on Subject: below --
2021-11-23 10:29 [PATCH 0/8 v4] " Jan Kara
2021-11-23 10:29 ` [PATCH 3/8] bfq: Store full bitmap depth in bfq_data Jan Kara
2021-11-25 13:36 [PATCH 0/8 v5] bfq: Limit number of allocated scheduler tags per cgroup Jan Kara
2021-11-25 13:36 ` [PATCH 3/8] bfq: Store full bitmap depth in bfq_data Jan Kara

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=20211006173157.6906-3-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=paolo.valente@linaro.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