Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guixin Liu <kanie@linux.alibaba.com>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Nilay Shroff <nilay@linux.ibm.com>,
	Daniel Wagner <dwagner@suse.de>, Hannes Reinecke <hare@suse.de>
Cc: linux-nvme@lists.infradead.org
Subject: [PATCH v3 0/3] nvme: introduce the service-time iopolicy
Date: Fri, 23 Oct 2026 15:02:38 +0800	[thread overview]
Message-ID: <20261023070243.2495522-1-kanie@linux.alibaba.com> (raw)

The queue-depth iopolicy counts requests, so a 128K I/O weighs the same
as a 4K one, and it cannot express that one path is simply faster than
another. This series adds a service-time iopolicy for NVMe native
multipath, adapted from dm-ps-service-time: it picks the path with the
lowest estimated service time, in_flight_bytes / relative_throughput,
so balancing follows actual bytes in flight and per-path throughput
weights.

Weights live in a per-path relative_throughput sysfs attribute (0-100,
default 1, 0 makes the path a standby). Patch 3 documents the new
attributes in the stable sysfs ABI; patch 1 carries the benchmark data
in its commit log.

Changes since v2 [1]:

- in_flight_bytes no longer leaks on failover: the accounted bytes
  are now released in nvme_failover_req() before blk_steal_bios()
  clears the request data length. Before, every failover (ANA
  transition, path error, queue_rq unwind) permanently left the
  request's bytes in the counter, skewing path selection until a
  controller reset. Reproduced with an ANA transition during load on
  the NVMe-oF/TCP test setup: the counter kept 512K of phantom bytes
  after all I/O completed; with the fix it returns to zero.

- The release clamps at zero instead of a plain subtraction. A
  request requeued across a controller reset is accounted against the
  pre-reset counter but completes after nvme_mpath_init_identify()
  re-zeroed it, and the plain subtraction would wrap negative, making
  the comparator treat the path as pathologically overloaded. This
  mirrors atomic_dec_if_positive() in the queue-depth accounting.

- The comparison operates on u64 instead of size_t, so the byte
  counts and the shift guard keep their magnitude on 32-bit builds,
  where size_t would truncate the atomic64 reads.

- Added "service-time" to the accepted values of the subsystem
  iopolicy ABI entry.

On the adaptive I/O policy dependency Hannes raised during v1: that
series has become the latency I/O policy [2] and is still under
revision, so this version stays on plain master. The two are
complementary: the latency policy infers path speed from observed
completions, service-time takes configured weights and byte counts.
I can rebase once the latency series lands.

Guixin Liu (3):
  nvme-multipath: implement service-time iopolicy
  nvme-multipath: document service-time iopolicy
  nvme: document the service-time iopolicy sysfs attributes

 Documentation/ABI/stable/sysfs-nvme          |  28 ++-
 Documentation/admin-guide/nvme-multipath.rst |  31 +++-
 drivers/nvme/host/multipath.c                | 189 ++++++++++++++++++-
 drivers/nvme/host/nvme.h                     |   6 +
 drivers/nvme/host/sysfs.c                    |   5 +-
 5 files changed, 251 insertions(+), 8 deletions(-)

v2 of this series:
https://lore.kernel.org/r/20261019075607.808947-1-kanie@linux.alibaba.com

v1 of this series:
https://lore.kernel.org/r/20260617114602.2224074-1-kanie@linux.alibaba.com

latency I/O policy v7:
https://lore.kernel.org/r/20260809100825.2014133-1-nilay@linux.ibm.com
-- 
2.43.7


             reply	other threads:[~2026-10-23  7:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  7:02 Guixin Liu [this message]
2026-10-23  7:02 ` [PATCH v3 1/3] nvme-multipath: implement service-time iopolicy Guixin Liu
2026-10-23  7:02 ` [PATCH v3 2/3] nvme-multipath: document " Guixin Liu
2026-10-23  7:02 ` [PATCH v3 3/3] nvme: document the service-time iopolicy sysfs attributes Guixin Liu
2026-10-24 10:37   ` Martin George
2026-10-26  2:09     ` Guixin Liu

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=20261023070243.2495522-1-kanie@linux.alibaba.com \
    --to=kanie@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=nilay@linux.ibm.com \
    --cc=sagi@grimberg.me \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox