All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: andrey.zhadchenko@virtuozzo.com, alexander.ivanov@virtuozzo.com,
	vasileios.almpanis@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.2 9/9] dm: default dm-qcow2 devices to no I/O scheduler
Date: Wed, 25 Nov 2026 02:25:25 +0100	[thread overview]
Message-ID: <20261125012525.681662-10-den@openvz.org> (raw)
In-Reply-To: <20261125012525.681662-1-den@openvz.org>

From: Denis V. Lunev <den@openvz.org>

Request-based dm has one hardware queue by default, so it gets
mq-deadline. On that queue mq-deadline caps requests in flight at 256
by default (2 * min(depth, BLKDEV_DEFAULT_RQ)) and serialises insert
and dispatch on its lock. The cost grows with queue depth and the
number of submitters. Sorting by device sector buys little for dm-qcow2
because adjacent guest sectors can be far apart in the image, and the
backing device can schedule the image I/O itself.

Set DM_TARGET_NO_SCHED_BY_DEFAULT on dm-qcow2. When the target in the
initial request-based table has this flag, dm_mq_init_request_queue()
sets BLK_MQ_F_NO_SCHED_BY_DEFAULT, as loop does, so elevator_set_default()
leaves the device with none.

mq-deadline arbitrates between I/O priority classes at dispatch. With
none, the dm device loses that arbitration. dm-qcow2 issues image I/O
from its workers, so the request's priority class does not reach the
backing device either. mq-deadline can still be selected through sysfs.

libploop creates qcow2 devices and ploop_dmcreate_stub() devices with a
zero-rq table and loads the real table later. Set the flag on zero-rq
as well because the scheduler is chosen when the device is created.

https://virtuozzo.atlassian.net/browse/VSTOR-95494
Feature: dm-qcow2: block device over QCOW2 files driver
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 drivers/md/dm-qcow2-target.c  | 3 ++-
 drivers/md/dm-rq.c            | 2 ++
 drivers/md/dm-zero-rq.c       | 2 +-
 include/linux/device-mapper.h | 5 +++++
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index af8a6d286830..3789fb191207 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -1274,7 +1274,8 @@ static void qcow2_resume(struct dm_target *ti)
 static struct target_type qcow2_target = {
 	.name = "qcow2",
 	.version = {1, 0, 0},
-	.features = DM_TARGET_SINGLETON | DM_TARGET_NOWAIT,
+	.features = DM_TARGET_SINGLETON | DM_TARGET_NOWAIT |
+		    DM_TARGET_NO_SCHED_BY_DEFAULT,
 	.module = THIS_MODULE,
 	.ctr = qcow2_ctr,
 	.dtr = qcow2_dtr,
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
index 0d31fcf84aed..af05ec40bf85 100644
--- a/drivers/md/dm-rq.c
+++ b/drivers/md/dm-rq.c
@@ -585,6 +585,8 @@ int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t)
 	md->tag_set->queue_depth = dm_get_blk_mq_queue_depth();
 	md->tag_set->numa_node = md->numa_node_id;
 	md->tag_set->flags = BLK_MQ_F_STACKING;
+	if (dm_target_no_sched_by_default(dm_table_get_target(t, 0)->type))
+		md->tag_set->flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
 	md->tag_set->nr_hw_queues = dm_get_blk_mq_nr_hw_queues();
 	md->tag_set->driver_data = md;
 
diff --git a/drivers/md/dm-zero-rq.c b/drivers/md/dm-zero-rq.c
index 315ef8c930b3..3584e86e80e2 100644
--- a/drivers/md/dm-zero-rq.c
+++ b/drivers/md/dm-zero-rq.c
@@ -60,7 +60,7 @@ static int zero_clone_and_map_rq(struct dm_target *ti, struct request *rq,
 static struct target_type zero_target = {
 	.name   = "zero-rq",
 	.version = {1, 1, 0},
-	.features = DM_TARGET_NOWAIT,
+	.features = DM_TARGET_NOWAIT | DM_TARGET_NO_SCHED_BY_DEFAULT,
 	.module = THIS_MODULE,
 	.ctr    = zero_ctr,
 	.clone_and_map_rq = zero_clone_and_map_rq,
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 05715910fae9..1b131ef7060b 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -313,6 +313,11 @@ struct target_type {
 #define DM_TARGET_ATOMIC_WRITES		0x00000400
 #define dm_target_supports_atomic_writes(type) ((type)->features & DM_TARGET_ATOMIC_WRITES)
 
+/* Skip the default I/O scheduler for this request-based target. */
+#define DM_TARGET_NO_SCHED_BY_DEFAULT	0x00000800
+#define dm_target_no_sched_by_default(type) \
+		((type)->features & DM_TARGET_NO_SCHED_BY_DEFAULT)
+
 struct dm_target {
 	struct dm_table *table;
 	struct target_type *type;
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-25  1:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  1:25 [Devel] [PATCH hci-8.2 0/9] dm-qcow2: lockless fast path, direct completion, " Denis V. Lunev
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 1/9] dm-qcow2: move md_pages_lock off the deferred_lock cache line Denis V. Lunev
2026-12-01  0:05   ` no-reply
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 2/9] dm-qcow2: free md pages after an RCU grace period Denis V. Lunev
2026-11-25 11:19   ` Konstantin Khorenko
2026-12-01  0:06   ` no-reply
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 3/9] dm-qcow2: map fast path reads without md_pages_lock Denis V. Lunev
2026-11-25 11:19   ` Konstantin Khorenko
2026-12-01  0:17   ` no-reply
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 4/9] dm-qcow2: map fast path writes " Denis V. Lunev
2026-11-25 11:19   ` Konstantin Khorenko
2026-12-01  0:25   ` no-reply
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 5/9] dm-qcow2: submit fast path qios without deferred_lock Denis V. Lunev
2026-12-01  0:27   ` no-reply
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 6/9] dm-rq: complete dm-qcow2 requests directly in task context Denis V. Lunev
2026-11-25 11:19   ` Konstantin Khorenko
2026-12-01  0:35   ` no-reply
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 7/9] dm-qcow2: requeue requests when the request pool is empty Denis V. Lunev
2026-12-01  0:37   ` no-reply
2026-11-25  1:25 ` [Devel] [PATCH hci-8.2 8/9] dm-ploop: " Denis V. Lunev
2026-11-25 11:19   ` Konstantin Khorenko
2026-12-01  0:38   ` no-reply
2026-11-25  1:25 ` Denis V. Lunev [this message]
2026-11-25 11:19   ` [Devel] [PATCH hci-8.2 9/9] dm: default dm-qcow2 devices to no I/O scheduler Konstantin Khorenko
2026-12-01  0:39   ` no-reply
2026-11-25 11:19 ` [Devel] [PATCH hci-8.2 0/9] dm-qcow2: lockless fast path, direct completion, " Konstantin Khorenko
2026-11-26 13:58 ` Andrey Zhadchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125012525.681662-10-den@openvz.org \
    --to=den@openvz.org \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=vasileios.almpanis@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.