From: Arthur Simchaev <arthur.simchaev@sandisk.com>
To: Daniel Gomez <da.gomez@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org,
Andres Freund <andres@anarazel.de>,
Pankaj Raghav <pankaj.raghav@linux.dev>,
GOST <gost.dev@samsung.com>, Daniel Gomez <da.gomez@samsung.com>,
Avi.Shchislowski@sandisk.com, Alex.Lemberg@sandisk.com
Subject: Re: [PATCH RFC 0/2] Support for Multiple Atomicity Mode
Date: Tue, 3 Nov 2026 11:38:39 +0200 [thread overview]
Message-ID: <20261103093839.203841-1-arthur.simchaev@sandisk.com> (raw)
In-Reply-To: <20260929-nvme-mam-v1-0-48dcbe79cece@samsung.com>
On Tue, Sep 29, 2026 at 01:17:10PM +0200, Daniel Gomez wrote:
> While I think this small feature is worth having (hence this RFC)
> for users sending atomic write commands that are contiguous, the
> question I'd also like to discuss really is how to also expose clear
> MAM semantics to userspace for users who can send larger commands,
> so they avoid syscall overhead [2] and splitting, and still get the
> atomic guarantees in the LBA subranges. RWF_ATOMIC currently exposes
> SAM semantics, but I think MAM may be confusing for users, as it's not
> simply a larger atomic write but an atomic carrier. Thoughts? What can
> work best to leverage MAM from userspace without conflicting with SAM?
Hi Daniel,
I agree that RWF_ATOMIC should keep its current meaning: the whole write is
untorn. Letting it accept larger writes on MAM devices would silently weaken
that guarantee for existing users.
If we want userspace to send one large write with per-piece guarantees, I would
keep RWF_ATOMIC unchanged and add a separate opt-in flag that describes the
guarantee rather than the device mode, for example (names are placeholders):
pwritev2(fd, iov, 1, pos, RWF_ATOMIC_CHUNKED);
- statx reports a granule G (e.g. stx_atomic_write_chunk)
- the range is split at file offsets that are multiples of G
- each piece is untorn; nothing is guaranteed across pieces
If G is tied to atomic_write_unit_max, a G-aligned piece never crosses an atomic
boundary, because the block layer already requires the boundary to be a power of
two no smaller than unit_max. A SAM device could then implement the flag with
one atomic bio per piece, and MAM would only be an optimisation underneath. Open
questions would be the semantics of partial completion and errors, and how
filesystems keep each piece mapped to one contiguous extent.
Before adding a new flag, though: with this series your fio example (io_uring,
iodepth_batch_submit=4) already sends four 16k RWF_ATOMIC writes as one 64k
command, so a single large write would only save per-I/O work in the kernel, not
device commands. I understand real MAM hardware may not be available, but that
cost can be estimated without it, e.g. by comparing host CPU usage of a batch of
small O_DIRECT writes against one large write of the same total size on any NVMe
device. Even a relative number (e.g. % CPU per GB written) would show whether
the remaining overhead justifies new uAPI.
Regards,
Arthur
prev parent reply other threads:[~2026-11-03 9:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 11:17 Daniel Gomez
2026-09-29 11:17 ` [PATCH RFC 1/2] block: add BLK_FEAT_ATOMIC_WRITE_MULTI Daniel Gomez
2026-11-03 9:38 ` Arthur Simchaev
2026-09-29 11:17 ` [PATCH RFC 2/2] nvme: enable multiple atomicity mode Daniel Gomez
2026-11-03 9:38 ` Arthur Simchaev
2026-11-03 9:38 ` Arthur Simchaev [this message]
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=20261103093839.203841-1-arthur.simchaev@sandisk.com \
--to=arthur.simchaev@sandisk.com \
--cc=Alex.Lemberg@sandisk.com \
--cc=Avi.Shchislowski@sandisk.com \
--cc=andres@anarazel.de \
--cc=axboe@kernel.dk \
--cc=da.gomez@kernel.org \
--cc=da.gomez@samsung.com \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=pankaj.raghav@linux.dev \
--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
all inboxes | Powered by JetHome®