lkml.org 
[lkml]   [2021]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 080/152] bfq: Fix computation of shallow depth
    Date
    From: Jan Kara <jack@suse.cz>

    [ Upstream commit 6d4d273588378c65915acaf7b2ee74e9dd9c130a ]

    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 <jack@suse.cz>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    block/bfq-iosched.c | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)

    diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
    index 9e81d1052091f..9e4eb0fc1c16e 100644
    --- a/block/bfq-iosched.c
    +++ b/block/bfq-iosched.c
    @@ -6332,13 +6332,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(bt->sb.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((bt->sb.depth * 3) >> 2, 1U);

    /*
    * 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,
    * 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((bt->sb.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((bt->sb.depth * 6) >> 4, 1U);

    for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++)
    --
    2.27.0


    \
     
     \ /
      Last update: 2021-01-18 12:59    [W:3.996 / U:0.328 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site