On 5/26/21 8:01 PM, Bart Van Assche wrote:
Rotational media (hard disks) benefit more from merging requests than non-rotational media. Reduce the read expire time for non-rotational media to reduce read latency. Cc: Damien Le Moal <damien.lemoal@xxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Ming Lei <ming.lei@xxxxxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> --- block/mq-deadline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/mq-deadline.c b/block/mq-deadline.c index dfbc6b77fa71..2ab844a4b6b5 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -29,7 +29,9 @@ /* * See Documentation/block/deadline-iosched.rst */ -static const int read_expire = HZ / 2; /* max time before a read is submitted. */ +/* max time before a read is submitted. */ +static const int read_expire_rot = HZ / 2; +static const int read_expire_nonrot = 1; static const int write_expire = 5 * HZ; /* ditto for writes, these limits are SOFT! */ static const int writes_starved = 2; /* max times reads can starve a write */ static const int fifo_batch = 16; /* # of sequential requests treated as one @@ -430,7 +432,8 @@ static int dd_init_sched(struct request_queue *q, struct elevator_type *e) INIT_LIST_HEAD(&dd->fifo_list[DD_WRITE]); dd->sort_list[DD_READ] = RB_ROOT; dd->sort_list[DD_WRITE] = RB_ROOT; - dd->fifo_expire[DD_READ] = read_expire; + dd->fifo_expire[DD_READ] = blk_queue_nonrot(q) ? read_expire_nonrot : + read_expire_rot; dd->fifo_expire[DD_WRITE] = write_expire; dd->writes_starved = writes_starved; dd->front_merges = 1;
Reviewed-by: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> -- Himanshu Madhani Oracle Linux Engineering