public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Joanne Koong <joannelkoong@gmail.com>
To: miklos@szeredi.hu, axboe@kernel.dk
Cc: linux-fsdevel@vger.kernel.org, bschubert@ddn.com,
	asml.silence@gmail.com,  io-uring@vger.kernel.org,
	xiaobing.li@samsung.com, csander@purestorage.com,
	 kernel-team@meta.com
Subject: Re: [PATCH v2 0/8] fuse: support io-uring registered buffers
Date: Fri, 14 Nov 2025 15:59:52 -0800	[thread overview]
Message-ID: <CAJnrk1bG7fAX8MfwJL_D2jzMNv5Rj9=1cgQvVpqC1=mGaeAwOg@mail.gmail.com> (raw)
In-Reply-To: <20251027222808.2332692-1-joannelkoong@gmail.com>

On Mon, Oct 27, 2025 at 3:29 PM Joanne Koong <joannelkoong@gmail.com> wrote:
>
> This patchset adds fuse support for io-uring registered buffers.
> Daemons may register buffers ahead of time, which will eliminate the overhead
> of pinning/unpinning user pages and translating virtual addresses for every
> server-kernel interaction.

Registered buffers helps with the I/O overhead, but there's still
significant memory waste within each buffer. Each entry in a queue
allocates a dedicated buffer of at least 1 MB (for some performant
servers like passthrough_hp, each entry's buffer is 4 MB, which adds
up (eg with the libfuse default queue depth of 8 on a 64-core machine,
that's 2 GB of buffers per fuse connection)) but most of this space
goes unused. In practice, entries on a queue will rarely consume their
full buffer capacity simultaneously.

Instead of using registered buffers, I think it's better if we go with
a kernel managed ring buffer. It'll have the same advantages in
reducing I/O overhead as registered buffers but also give us
optionality later on to support IORING_CQE_F_BUF_MORE for incremental
buffer consumption or add multiple different-sized ring buffer pools
(eg for large payloads vs small payloads, which is also something we
have to differentiate between for zero-copy), whereas we would have no
way of supporting that with registered buffers.

For v3, I'm going to go this direction.

Thanks,
Joanne

>
> The main logic for fuse registered buffers is in the last patch (patch 8/8).
> Patch 1/8 adds an io_uring api for fetching the registered buffer and patches
> (2-7)/8 refactors the fuse io_uring code, which additionally will make adding
> in the logic for registered buffers neater.
>
> The libfuse changes can be found in this branch:
> https://github.com/joannekoong/libfuse/tree/registered_buffers. The libfuse
> implementation first tries registered buffers during registration and if this
> fails, will retry with non-registered buffers. This prevents having to add a
> new init flag (but does have the downside of printing dmesg errors for the
> failed registrations when trying the registered buffers). If using registered
> buffers and the daemon for whatever reason unregisters the buffers midway
> through, then this will sever server-kernel communication. Libfuse will never
> do this. Libfuse will only unregister the buffers when the entire session is
> being destroyed.
>
> Benchmarks will be run and posted.
>
> Thanks,
> Joanne
>
> v1: https://lore.kernel.org/linux-fsdevel/20251022202021.3649586-1-joannelkoong@gmail.com/
> v1 -> v2:
> * Add io_uring_cmd_import_fixed_full() patch
> * Construct iter using io_uring_cmd_import_fixed_full() per cmd instead of recyling
>   iters.
> * Kmap the header instead of using bvec iter for iterating/copying. This makes
>   the code easier to read.
>
> Joanne Koong (8):
>   io_uring/uring_cmd: add io_uring_cmd_import_fixed_full()
>   fuse: refactor io-uring logic for getting next fuse request
>   fuse: refactor io-uring header copying to ring
>   fuse: refactor io-uring header copying from ring
>   fuse: use enum types for header copying
>   fuse: add user_ prefix to userspace headers and payload fields
>   fuse: refactor setting up copy state for payload copying
>   fuse: support io-uring registered buffers
>
>  fs/fuse/dev_uring.c          | 366 +++++++++++++++++++++++++----------
>  fs/fuse/dev_uring_i.h        |  27 ++-
>  include/linux/io_uring/cmd.h |   3 +
>  io_uring/rsrc.c              |  14 ++
>  io_uring/rsrc.h              |   2 +
>  io_uring/uring_cmd.c         |  13 ++
>  6 files changed, 316 insertions(+), 109 deletions(-)
>
> --
> 2.47.3
>

      parent reply	other threads:[~2025-11-15  0:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 22:27 [PATCH v2 0/8] fuse: support io-uring registered buffers Joanne Koong
2025-10-27 22:28 ` [PATCH v2 1/8] io_uring/uring_cmd: add io_uring_cmd_import_fixed_full() Joanne Koong
2025-10-28  1:28   ` Caleb Sander Mateos
2025-10-29 14:01   ` Pavel Begunkov
2025-10-29 18:37     ` Joanne Koong
2025-10-29 19:59       ` Bernd Schubert
2025-10-30 17:42         ` Pavel Begunkov
2025-10-30 18:06       ` Pavel Begunkov
2025-10-30 22:23         ` Bernd Schubert
2025-10-30 23:50           ` Joanne Koong
2025-10-31 10:27             ` Bernd Schubert
2025-10-31 21:19               ` Joanne Koong
2025-10-30 23:13         ` Joanne Koong
2025-10-27 22:28 ` [PATCH v2 2/8] fuse: refactor io-uring logic for getting next fuse request Joanne Koong
2025-10-30 23:07   ` Bernd Schubert
2025-10-27 22:28 ` [PATCH v2 3/8] fuse: refactor io-uring header copying to ring Joanne Koong
2025-10-30 23:15   ` Bernd Schubert
2025-10-30 23:52     ` Joanne Koong
2025-10-27 22:28 ` [PATCH v2 4/8] fuse: refactor io-uring header copying from ring Joanne Koong
2025-10-27 22:28 ` [PATCH v2 5/8] fuse: use enum types for header copying Joanne Koong
2025-11-05 23:01   ` Bernd Schubert
2025-11-06 21:59     ` Joanne Koong
2025-11-07 22:11       ` Bernd Schubert
2025-10-27 22:28 ` [PATCH v2 6/8] fuse: add user_ prefix to userspace headers and payload fields Joanne Koong
2025-10-28  1:32   ` Caleb Sander Mateos
2025-10-28 23:56     ` Joanne Koong
2025-11-06 13:35   ` Bernd Schubert
2025-10-27 22:28 ` [PATCH v2 7/8] fuse: refactor setting up copy state for payload copying Joanne Koong
2025-11-06 16:53   ` Bernd Schubert
2025-11-06 22:01     ` Joanne Koong
2025-10-27 22:28 ` [PATCH v2 8/8] fuse: support io-uring registered buffers Joanne Koong
2025-10-28  1:42   ` Caleb Sander Mateos
2025-10-28 23:56     ` Joanne Koong
2025-11-06 19:48   ` Bernd Schubert
2025-11-06 23:09     ` Joanne Koong
2025-11-07 22:16       ` Bernd Schubert
2025-11-07 22:23         ` Bernd Schubert
2025-11-23 20:12       ` Bernd Schubert
2025-11-25  1:13         ` Joanne Koong
2025-11-14 23:59 ` Joanne Koong [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='CAJnrk1bG7fAX8MfwJL_D2jzMNv5Rj9=1cgQvVpqC1=mGaeAwOg@mail.gmail.com' \
    --to=joannelkoong@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bschubert@ddn.com \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=xiaobing.li@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox