On 3/12/20 11:33 PM, Shinichiro Kawasaki wrote: > On Mar 12, 2020 / 07:26, Jens Axboe wrote: >> On 3/12/20 3:15 AM, Ming Lei wrote: >>> commit 01e99aeca397 ("blk-mq: insert passthrough request into >>> hctx->dispatch directly") may change to add flush request to the tail >>> of dispatch by applying the 'add_head' parameter of >>> blk_mq_sched_insert_request. >>> >>> Turns out this way causes performance regression on NCQ controller because >>> flush is non-NCQ command, which can't be queued when there is any in-flight >>> NCQ command. When adding flush rq to the front of hctx->dispatch, it is >>> easier to introduce extra time to flush rq's latency compared with adding >>> to the tail of dispatch queue because of S_SCHED_RESTART, then chance of >>> flush merge is increased, and less flush requests may be issued to >>> controller. >>> >>> So always insert flush request to the front of dispatch queue just like >>> before applying commit 01e99aeca397 ("blk-mq: insert passthrough request >>> into hctx->dispatch directly"). >> >> Applied, thanks. > > Ming, thank you so much for the patch. Using my SMR SATA drive I confirmed it > reduces blktests block/004 runtime as expected. With this patch, the runtime is > like before the commit 01e99aeca397. Good. Thanks for testing, it'll go into 5.6. -- Jens Axboe