Skip to content

Commit 6d4d273

Browse files
jankaraaxboe
authored andcommitted
bfq: Fix computation of shallow depth
BFQ computes number of tags it allows to be allocated for each request type based on tag bitmap. However it uses 1 << bitmap.shift as number of available tags which is wrong. 'shift' is just an internal bitmap value containing logarithm of how many bits bitmap uses in each bitmap word. Thus number of tags allowed for some request types can be far to low. Use proper bitmap.depth which has the number of tags instead. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent d16baa3 commit 6d4d273

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

block/bfq-iosched.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6332,13 +6332,13 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
63326332
* limit 'something'.
63336333
*/
63346334
/* no more than 50% of tags for async I/O */
6335-
bfqd->word_depths[0][0] = max((1U << bt->sb.shift) >> 1, 1U);
6335+
bfqd->word_depths[0][0] = max(bt->sb.depth >> 1, 1U);
63366336
/*
63376337
* no more than 75% of tags for sync writes (25% extra tags
63386338
* w.r.t. async I/O, to prevent async I/O from starving sync
63396339
* writes)
63406340
*/
6341-
bfqd->word_depths[0][1] = max(((1U << bt->sb.shift) * 3) >> 2, 1U);
6341+
bfqd->word_depths[0][1] = max((bt->sb.depth * 3) >> 2, 1U);
63426342

63436343
/*
63446344
* In-word depths in case some bfq_queue is being weight-
@@ -6348,9 +6348,9 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
63486348
* shortage.
63496349
*/
63506350
/* no more than ~18% of tags for async I/O */
6351-
bfqd->word_depths[1][0] = max(((1U << bt->sb.shift) * 3) >> 4, 1U);
6351+
bfqd->word_depths[1][0] = max((bt->sb.depth * 3) >> 4, 1U);
63526352
/* no more than ~37% of tags for sync writes (~20% extra tags) */
6353-
bfqd->word_depths[1][1] = max(((1U << bt->sb.shift) * 6) >> 4, 1U);
6353+
bfqd->word_depths[1][1] = max((bt->sb.depth * 6) >> 4, 1U);
63546354

63556355
for (i = 0; i < 2; i++)
63566356
for (j = 0; j < 2; j++)

0 commit comments

Comments
 (0)