From: Suho Son <suho.son@samsung.com>
To: "axboe@kernel.dk" <axboe@kernel.dk>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Cc: "tj@kernel.org" <tj@kernel.org>,
"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
"mkoutny@suse.com" <mkoutny@suse.com>,
"corbet@lwn.net" <corbet@lwn.net>,
"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
"rdunlap@infradead.org" <rdunlap@infradead.org>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"brauner@kernel.org" <brauner@kernel.org>,
"jack@suse.cz" <jack@suse.cz>,
"io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"ngeol564@gmail.com" <ngeol564@gmail.com>,
KiYoung Lee <kiyoung77.lee@samsung.com>,
JinHeon Kim <jinheon09.kim@samsung.com>,
Suho Son <suho.son@samsung.com>
Subject: [RFC PATCH RESEND 0/3] block: cgroup-based and explicit write stream placement for NVMe FDP
Date: Mon, 23 Nov 2026 14:15:21 +0900 [thread overview]
Message-ID: <20261123051521epcms2p2445107f926f3acaa2d51c5e12abea90e@epcms2p2> (raw)
In-Reply-To: <CGME20261123051521epcms2p2445107f926f3acaa2d51c5e12abea90e@epcms2p2>
Hello,
Resending: my earlier posting of this cover letter went out without
the patches threaded to it. Sorry for the noise.
This RFC proposes an operator- and application-controlled write stream
interface on top of the existing write stream plumbing
(sqe->write_stream, bio->bi_write_stream, and the NVMe FDP placement
translation, which are unchanged by this series):
1/3 block: distinguish unspecified and explicit device-default write streams
2/3 io_uring: add IORING_WRITE_STREAM_DEFAULT for explicit device-default placement
3/3 blk-cgroup: add cgroup-based write stream placement
The series is based on the block tree's for-next branch (see the
base-commit below).
Motivation and background are described in our HotStorage '26 paper:
Link: https://doi.org/10.1145/3837053.3837343
Motivation
NVMe Flexible Data Placement reduces write amplification by grouping
similarly-aged data into per-reclaim-unit placement handles, and the
kernel already lets a single application tag writes through io_uring.
Two gaps remain:
(a) an operator cannot place whole workloads per cgroup without
modifying applications, and
(b) an application cannot force the device-default placement and be
sure that no policy overrides that choice.
The series addresses the root cause shared by both: write stream zero
currently means both "unspecified" and "device default", so lower-
precedence producers cannot tell whether a stream was requested. The
resulting precedence, most specific first, is:
explicit io_uring stream (including DEFAULT)
> inode write hint
> cgroup io.stream
> device default (0)
Patch 1 introduces the WRITE_STREAM_NONE sentinel for unspecified
streams, resolves it centrally before the bio reaches the driver, and
carries ki_write_stream through kiocb_clone() used by forwarded direct
I/O. Patch 2 adds the explicit-default UAPI value, decided at prep
time so it survives async re-issues. Patch 3 adds the io.stream cgroup
v2 interface: per-device upsert entries, "inherit" reset, explicit 0,
validation against device queue limits, lazy policy activation, and a
single-word policy state read locklessly under RCU, with writers
serialized by the queue lock held across blkg_conf_prep().
Runtime verification
We exercised the series, as posted, on an NVMe 2.0 FDP device (8 RUHs)
with bpftrace observers at blkcg_set_iostream() entry/return,
__submit_bio() and the nvme_setup_cmd() dsmgmt export:
- explicit streams 2/5/8 -> placement IDs 1/4/7 (tracepoint-verified)
- IORING_WRITE_STREAM_DEFAULT -> concrete 0, no placement exported,
not overridable by an io.stream policy
- stream > max_write_streams -> -EINVAL, no bio issued
- io.stream explicit value observed end-to-end; nested cgroup
inherits the parent's entry; explicit io.stream 0 resolves the
sentinel to 0
- io.stream rejects streams above the device limit and the reserved
255 with -EINVAL, and devices without write streams with
-EOPNOTSUPP; the root cgroup has no io.stream file
- the inode write hint beats the io.stream value, as documented
- IOSQE_ASYNC: an explicit stream, IORING_WRITE_STREAM_DEFAULT and
the submitting task's cgroup association all survive io-wq
deferral
- a 512K direct write splits into multiple bios; all keep the stream
- 64 concurrent writers with a common stream: 64/64 tagged, stable,
no warnings
- buffered writeback on a mounted ext4: writeback bios adopt the
first-dirtying cgroup via wbc_init_bio() and carry the resulting
placement ID to the device; the nested cgroup inherits the
parent's entry, explicit 0 and the child's own entry override it,
and "inherit" restores the parent's value
Each patch builds without warnings at W=1, with
CONFIG_BLK_CGROUP_IOSTREAM both enabled and disabled.
Not yet verified (please treat accordingly)
- WAF improvements on a production multi-tenant workload are not yet
measured; device-level fdp status counters moved consistently with
the placement IDs, but per-case deltas were below the background
noise of the test setup
RFC aspects we would like feedback on
- the API shape of io.stream (per-device "MAJ:MIN <stream>" string,
upsert and inherit semantics, explicit 0 as a real entry)
- the WRITE_STREAM_NONE sentinel as a u8 reservation, which caps
addressable streams at 254 through the io_uring interface and
excludes 255 from io.stream
- whether io.stream belongs in io.* under cgroup v2, and its
interaction with the existing io controller file hierarchy
- buffered writeback semantics: attribution to the writeback owner is
arguably what an operator wants, but degenerate share cases deserve
a second opinion
No MAINTAINERS update is needed: block/ is covered by the BLOCK LAYER
entry, and the io_uring paths by the IO_URING entry.
Tool use
This series was developed with substantial help from LLM coding
assistants, in an interactive session rather than from a single prompt.
The assistant drafted a large part of the implementation (the
WRITE_STREAM_NONE sentinel and its central resolution, the fops.c
precedence rework, the kiocb_clone() propagation, and the io.stream
single-word policy state and its RCU lifetime), the changelogs, the
cgroup-v2.rst section and this cover letter. It also wrote the
io_uring and bpftrace test harnesses used for the runtime verification
above, and rebased the series onto the current tree. I made the design
decisions, directed and reviewed the testing, and reviewed, revised and
take responsibility for all of the code and text.
Suho Son (3):
block: distinguish unspecified and explicit device-default write
streams
io_uring: add IORING_WRITE_STREAM_DEFAULT for explicit device-default
placement
blk-cgroup: add cgroup-based write stream placement
Documentation/admin-guide/cgroup-v2.rst | 58 ++++-
block/Kconfig | 16 ++
block/Makefile | 1 +
block/bio.c | 3 +-
block/blk-core.c | 14 ++
block/blk-iostream.c | 315 ++++++++++++++++++++++++
block/blk-iostream.h | 18 ++
block/fops.c | 25 +-
include/linux/blk_types.h | 13 +
include/linux/fs.h | 11 +-
include/linux/io_uring_types.h | 4 +
include/uapi/linux/io_uring.h | 26 ++
io_uring/rw.c | 16 ++
13 files changed, 510 insertions(+), 10 deletions(-)
create mode 100644 block/blk-iostream.c
create mode 100644 block/blk-iostream.h
base-commit: d09b6d9d1fcce0770c1824c8b2b8ab153f2672d2
--
2.43.0
next parent reply other threads:[~2026-11-23 5:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20261123051521epcms2p2445107f926f3acaa2d51c5e12abea90e@epcms2p2>
2026-11-23 5:15 ` Suho Son [this message]
[not found] ` <CGME20261123051521epcms2p2445107f926f3acaa2d51c5e12abea90e@epcms2p7>
2026-11-23 5:16 ` [RFC PATCH RESEND 1/3] block: distinguish unspecified and explicit device-default write streams Suho Son
2026-11-23 5:27 ` [RFC PATCH RESEND 3/3] blk-cgroup: add cgroup-based write stream placement Suho Son
2026-11-23 5:17 ` [RFC PATCH RESEND 2/3] io_uring: add IORING_WRITE_STREAM_DEFAULT for explicit device-default placement Suho Son
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=20261123051521epcms2p2445107f926f3acaa2d51c5e12abea90e@epcms2p2 \
--to=suho.son@samsung.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=io-uring@vger.kernel.org \
--cc=jack@suse.cz \
--cc=jinheon09.kim@samsung.com \
--cc=kiyoung77.lee@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=ngeol564@gmail.com \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®