Skip to content

Commit d87447d

Browse files
Algodev-githubaxboe
authored andcommitted
block, bfq: fix sequential rq detection in rate estimation
In bfq_update_peak_rate, to check whether an I/O request rq is sequential, only the seek distance of rq w.r.t. the last request dispatched is controlled. This is not sufficient for non-rotational storage, where the size of rq is at least as relevant. This commit adds the missing control. Signed-off-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 530c4cb commit d87447d

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎block/bfq-iosched.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ static struct kmem_cache *bfq_pool;
235235

236236
#define BFQQ_SEEK_THR (sector_t)(8 * 100)
237237
#define BFQQ_SECT_THR_NONROT (sector_t)(2 * 32)
238+
#define BFQ_RQ_SEEKY(bfqd, last_pos, rq) \
239+
(get_sdist(last_pos, rq) > \
240+
BFQQ_SEEK_THR && \
241+
(!blk_queue_nonrot(bfqd->queue) || \
242+
blk_rq_sectors(rq) < BFQQ_SECT_THR_NONROT))
238243
#define BFQQ_CLOSE_THR (sector_t)(8 * 1024)
239244
#define BFQQ_SEEKY(bfqq) (hweight32(bfqq->seek_history) > 19)
240245

@@ -2754,7 +2759,7 @@ static void bfq_update_peak_rate(struct bfq_data *bfqd, struct request *rq)
27542759

27552760
if ((bfqd->rq_in_driver > 0 ||
27562761
now_ns - bfqd->last_completion < BFQ_MIN_TT)
2757-
&& get_sdist(bfqd->last_position, rq) < BFQQ_SEEK_THR)
2762+
&& !BFQ_RQ_SEEKY(bfqd, bfqd->last_position, rq))
27582763
bfqd->sequential_samples++;
27592764

27602765
bfqd->tot_sectors_dispatched += blk_rq_sectors(rq);
@@ -4511,10 +4516,7 @@ bfq_update_io_seektime(struct bfq_data *bfqd, struct bfq_queue *bfqq,
45114516
struct request *rq)
45124517
{
45134518
bfqq->seek_history <<= 1;
4514-
bfqq->seek_history |=
4515-
get_sdist(bfqq->last_request_pos, rq) > BFQQ_SEEK_THR &&
4516-
(!blk_queue_nonrot(bfqd->queue) ||
4517-
blk_rq_sectors(rq) < BFQQ_SECT_THR_NONROT);
4519+
bfqq->seek_history |= BFQ_RQ_SEEKY(bfqd, bfqq->last_request_pos, rq);
45184520
}
45194521

45204522
static void bfq_update_has_short_ttime(struct bfq_data *bfqd,

0 commit comments

Comments
 (0)