Skip to content

Commit b3c3498

Browse files
Algodev-githubaxboe
authored andcommitted
block, bfq: port commit "cfq-iosched: improve hw_tag detection"
The original commit is commit 1a1238a ("cfq-iosched: improve hw_tag detection") and has the following commit message: If active queue hasn't enough requests and idle window opens, cfq will not dispatch sufficient requests to hardware. In such situation, current code will zero hw_tag. But this is because cfq doesn't dispatch enough requests instead of hardware queue doesn't work. Don't zero hw_tag in such case. Signed-off-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent a3c9256 commit b3c3498

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎block/bfq-iosched.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4786,6 +4786,8 @@ static void bfq_insert_requests(struct blk_mq_hw_ctx *hctx,
47864786

47874787
static void bfq_update_hw_tag(struct bfq_data *bfqd)
47884788
{
4789+
struct bfq_queue *bfqq = bfqd->in_service_queue;
4790+
47894791
bfqd->max_rq_in_driver = max_t(int, bfqd->max_rq_in_driver,
47904792
bfqd->rq_in_driver);
47914793

@@ -4801,6 +4803,17 @@ static void bfq_update_hw_tag(struct bfq_data *bfqd)
48014803
if (bfqd->rq_in_driver + bfqd->queued <= BFQ_HW_QUEUE_THRESHOLD)
48024804
return;
48034805

4806+
/*
4807+
* If active queue hasn't enough requests and can idle, bfq might not
4808+
* dispatch sufficient requests to hardware. Don't zero hw_tag in this
4809+
* case
4810+
*/
4811+
if (bfqq && bfq_bfqq_has_short_ttime(bfqq) &&
4812+
bfqq->dispatched + bfqq->queued[0] + bfqq->queued[1] <
4813+
BFQ_HW_QUEUE_THRESHOLD &&
4814+
bfqd->rq_in_driver < BFQ_HW_QUEUE_THRESHOLD)
4815+
return;
4816+
48044817
if (bfqd->hw_tag_samples++ < BFQ_HW_QUEUE_SAMPLES)
48054818
return;
48064819

0 commit comments

Comments
 (0)