]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Wed, 17 May 2023 11:33:15 +0000 (13:33 +0200)
commit7f2c07a7932b95eaf429d5db651fee00fb663af8
tree386d6582472e98e3f42d934a708aab84ebca05b0
parente1dba03e9a7bfc9ce9e07e2a6b65a7679a8fdc6d
block: do not reverse request order when flushing plug list

BugLink: https://bugs.launchpad.net/bugs/2016876
[ Upstream commit 34e0a279a993debaff03158fc2fbf6a00c093643 ]

Commit 26fed4ac4eab ("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: 26fed4ac4eab ("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>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
block/blk-mq.c
include/linux/blk-mq.h