bfq: Fix computation of shallow depth
Subsystems (2)
PATCH 1/1 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.
--- block/bfq-iosched.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
block/bfq-iosched.c +4 -4
@@ -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++)
Signature · 1 line
2.16.4
Quoted 8 lines · Jan Kara
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]>
Ping Jens? I think it has fallen through the cracks?
Honza
Quoted 39 lines
--- block/bfq-iosched.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)block/bfq-iosched.c +4
-4@@ -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++)Signature · 1 line
2.16.4
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Jens Axboe
maintainerQuoted 11 lines · Jan Kara
Quoted 8 lines · Jan Kara
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]>Ping Jens? I think it has fallen through the cracks?
More like waiting for Paolo to take a look. Don't mind taking it, and I'll do that now, but I do expect him to review any BFQ patches being sent out.
Signature · 1 line
Jens Axboe
Quoted 13 lines
Il giorno 5 gen 2021, alle ore 17:29, Jens Axboe <[email protected]> ha scritto:
Quoted 8 lines · Jan Kara
Quoted 7 lines · Jan Kara
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.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Jan Kara <[email protected]>Ping Jens? I think it has fallen through the cracks?
More like waiting for Paolo to take a look. Don't mind taking it, and I'll do that now, but I do expect him to review any BFQ patches being sent out.
Sorry for the delay Jan. As you know, my priority is currently to finalize the patches I have developed with your help; and unfortunately I'm way behind. This is delaying also my review activity.
As for your proposal, I remember I found the right parameter rather empirically. In particular, I seem to remember that the bitmap.depth parameter did not contain the value I needed, i.e, it did not contain the total number of tags. But maybe something has changed in the meantime. At any rate, if bitmap.depth does contain that value, then your replacement is ok.
If your replacement is ok, then I guess you may want to also fix the comments above the changes you propose.
Thanks,
Paolo
Quoted 3 lines
Signature · 1 line
Jens Axboe
Quoted 24 lines · Paolo Valente
Quoted 11 lines
Il giorno 5 gen 2021, alle ore 17:29, Jens Axboe <[email protected]> ha scritto:
Quoted 8 lines · Jan Kara
Quoted 7 lines · Jan Kara
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.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Jan Kara <[email protected]>Ping Jens? I think it has fallen through the cracks?
More like waiting for Paolo to take a look. Don't mind taking it, and I'll do that now, but I do expect him to review any BFQ patches being sent out.
Sorry for the delay Jan. As you know, my priority is currently to finalize the patches I have developed with your help; and unfortunately I'm way behind. This is delaying also my review activity.
Quoted 6 lines
As for your proposal, I remember I found the right parameter rather empirically. In particular, I seem to remember that the bitmap.depth parameter did not contain the value I needed, i.e, it did not contain the total number of tags. But maybe something has changed in the meantime. At any rate, if bitmap.depth does contain that value, then your replacement is ok.
Yes, bitmap.depth is the total number of tags AFAIK.
Quoted 2 lines
If your replacement is ok, then I guess you may want to also fix the comments above the changes you propose.
Oh right, there's one paragraph in the comment that my patch made redundant. I'll send a cleanup. Thanks for noticing.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR