Commit 41647e7a authored by Corrado Zoccolo's avatar Corrado Zoccolo Committed by Jens Axboe

cfq-iosched: rethink seeky detection for SSDs

CFQ currently applies the same logic of detecting seeky queues and
grouping them together for rotational disks as well as SSDs.
For SSDs, the time to complete a request doesn't depend on the
request location, but only on the size.
This patch therefore changes the criterion to group queues by
request size in case of SSDs, in order to achieve better fairness.
Signed-off-by: default avatarCorrado Zoccolo <czoccolo@gmail.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 3dde36dd
...@@ -47,6 +47,7 @@ static const int cfq_hist_divisor = 4; ...@@ -47,6 +47,7 @@ static const int cfq_hist_divisor = 4;
#define CFQ_SERVICE_SHIFT 12 #define CFQ_SERVICE_SHIFT 12
#define CFQQ_SEEK_THR (sector_t)(8 * 100) #define CFQQ_SEEK_THR (sector_t)(8 * 100)
#define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32)
#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8) #define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8)
#define RQ_CIC(rq) \ #define RQ_CIC(rq) \
...@@ -2965,6 +2966,7 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq, ...@@ -2965,6 +2966,7 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq,
struct request *rq) struct request *rq)
{ {
sector_t sdist = 0; sector_t sdist = 0;
sector_t n_sec = blk_rq_sectors(rq);
if (cfqq->last_request_pos) { if (cfqq->last_request_pos) {
if (cfqq->last_request_pos < blk_rq_pos(rq)) if (cfqq->last_request_pos < blk_rq_pos(rq))
sdist = blk_rq_pos(rq) - cfqq->last_request_pos; sdist = blk_rq_pos(rq) - cfqq->last_request_pos;
...@@ -2973,7 +2975,10 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq, ...@@ -2973,7 +2975,10 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq,
} }
cfqq->seek_history <<= 1; cfqq->seek_history <<= 1;
cfqq->seek_history |= (sdist > CFQQ_SEEK_THR); if (blk_queue_nonrot(cfqd->queue))
cfqq->seek_history |= (n_sec < CFQQ_SECT_THR_NONROT);
else
cfqq->seek_history |= (sdist > CFQQ_SEEK_THR);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment