[Devel] [PATCH hci-8.1 7/7] drivers/md/dm-qcow2: process fast path qios in per-cpu batches on a workqueue
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Nov 5 00:35:09 MSK 2026
I won't apply this version, please send v2 with the changes below.
On Thu, 29 Oct 2026 17:03:46 +0300, Andrey Zhadchenko wrote:
> context switch) even if a running worker would pick the work up right
> away. PENDING is cleared when execution starts, so a qio re-queued
> while its work runs wakes yet another worker just to find the collision
> and go back to sleep. On a 12 cpu box with 4 submitters this shows up
> as ~3 context switches per I/O, 5% of all cycles spinning on
> pool->lock and 6% in the scheduler.
Items 4 and 5 of the cover letter reply:
- fix the re-queue sentence;
- move the measurements into this thread;
- add a paragraph that the fast path is now serial per submitting
CPU, and why that is acceptable.
Why: after patch 4 every qio work is queued exactly once, so no qio is
re-queued while it runs. The work that is re-queued while running is
qcow2->worker, and this patch does not touch it.
On your answer to Sashiko: O_DIRECT is enforced for every delta, that
holds. "We only submit IO" does not hold for all fast-path qios: a
partial discard runs qcow2_punch_hole() right in this worker, which
takes the inode lock and waits for all direct I/O in flight on the
image. Everything queued on that CPU waits behind it. Either send
partial discards to the slow path or say it in the message.
> + for (;;) {
> + node = llist_del_all(&fc->qios);
> + if (!node) {
Item 4 of the cover letter reply: bound the loop, or add
cond_resched() between batches.
Why: while one CPU keeps refilling its llist this work item never
returns. flush_workqueue() in qcow2_flush_deferred_activity(), which
the backward merge completion calls with I/O still running, waits for
it.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
More information about the Devel
mailing list