On 2021/05/27 10:02, 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 "Reduce the read expire time for non-rotational..." -> "Reduce the default read expire time for non-rotational..." > to reduce read latency. I am not against this, but I wonder if we should not let udev do that with some rules instead of adding totally arbitrary values here... > > 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; > -- Damien Le Moal Western Digital Research