]> git.baikalelectronics.ru Git - kernel.git/commit
block: do not reverse request order when flushing plug list
authorJan Kara <jack@suse.cz>
Mon, 13 Mar 2023 09:30:02 +0000 (10:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:33:46 +0000 (13:33 +0100)
commitb97591d78d5ec1413a74531542c937d3ea0c55c8
tree49a14883e420ac7e8871710ddb47b384d4bf0685
parent2ea95aa025a6a547253c01bdd2439cbca418fa80
block: do not reverse request order when flushing plug list

[ Upstream commit c7c29194de217df21ff011508aafdddaec4c3b82 ]

Commit b72f965ca95b ("block: flush plug based on hardware and software
queue order") changed flushing of plug list to submit requests one
device at a time. However while doing that it also started using
list_add_tail() instead of list_add() used previously thus effectively
submitting requests in reverse order. Also when forming a rq_list with
remaining requests (in case two or more devices are used), we
effectively reverse the ordering of the plug list for each device we
process. Submitting requests in reverse order has negative impact on
performance for rotational disks (when BFQ is not in use). We observe
10-25% regression in random 4k write throughput, as well as ~20%
regression in MariaDB OLTP benchmark on rotational storage on btrfs
filesystem.

Fix the problem by preserving ordering of the plug list when inserting
requests into the queuelist as well as by appending to requeue_list
instead of prepending to it.

Fixes: b72f965ca95b ("block: flush plug based on hardware and software queue order")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230313093002.11756-1-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/blk-mq.c
include/linux/blk-mq.h