dm-qcow2 processes every request sequentially in a single kwork. Unfortunately this introduces latency and cpu-bound limits. This patchset adds a fast path: right after splitting, qios which need no metadata changes are processed outside the main kwork, in parallel with it and with each other. These are: - reads and writes of fully allocated clusters; - reads of unallocated clusters, which are zero-filled or forwarded to the lower delta; - partial discards, which only punch a hole in the image file. Everything else (allocations, COW, compressed clusters, discards changing metadata, backward merge) still goes to the main kwork.
Fast path qios are batched in per-cpu llists and processed by one work per submitting CPU, to avoid queue_work() cost on every I/O. The target also declares DM_TARGET_NOWAIT now, so io_uring submits I/O inline instead of punting every request to io-wq. Patch 1 fixes a race with md page insertion which already exists between qcow2_llseek_hole() and the main kwork, and which the fast path makes more likely. Patch 2 makes perform_rw_mapped() safe to run in parallel with the main kwork md writeback. v2: - patch 2 waits for L2 writeback, so a fast path write is not acked before its L2 entry is on disk - batching goes before DM_TARGET_NOWAIT, and its worker no longer loops unbounded - measurements moved to the thread - subject prefix changed to dm-qcow2 Details are in the patches. https://virtuozzo.atlassian.net/browse/VSTOR-95494 Andrey Zhadchenko (7): dm-qcow2: repeat md page lookup if it was inserted in parallel dm-qcow2: wait for L2 writeback in perform_rw_mapped() dm-qcow2: prepare process_one_qio() for fastpath dm-qcow2: add per-qio work infrastructure dm-qcow2: implement per-qio fast processing dm-qcow2: process fast path qios in per-cpu batches on a workqueue dm-qcow2: declare DM_TARGET_NOWAIT drivers/md/dm-qcow2-map.c | 245 +++++++++++++++++++++++++++++------ drivers/md/dm-qcow2-target.c | 12 +- drivers/md/dm-qcow2.h | 16 ++- 3 files changed, 229 insertions(+), 44 deletions(-) -- 2.43.5 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
