All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernd Schubert <bernd@bsbernd.com>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Luis Henriques <luis@igalia.com>, Gang He <dchg2000@gmail.com>,
	fuse-devel@lists.linux.dev, Bernd Schubert <bschubert@ddn.com>
Subject: Re: [PATCH v5 4/7] fuse: {io-uring} Allow reduced number of ring queues
Date: Tue, 23 Jun 2026 01:52:13 +0200	[thread overview]
Message-ID: <8568d20e-b00c-4902-a200-024f8cc1feba@bsbernd.com> (raw)
In-Reply-To: <CAJnrk1Z7ECu5vLqnO7ubdkBLZqLB42njaBinqg2LMWpqx=s4Ew@mail.gmail.com>



On 6/23/26 01:32, Joanne Koong wrote:
> zOn Fri, Jun 12, 2026 at 7:24 PM Joanne Koong <joannelkoong@gmail.com> wrote:
>>
>> On Thu, May 28, 2026 at 3:55 PM Bernd Schubert via B4 Relay
>> <devnull+bernd.bsbernd.com@kernel.org> wrote:
>>>
>>> From: Bernd Schubert <bschubert@ddn.com>
>>>
>>> Queues selection (fuse_uring_get_queue) can handle reduced number
>>> queues - using io-uring is possible now even with a single
>>> queue and entry.
>>>
>>> The FUSE_URING_REDUCED_Q flag is introduced tell fuse server that
>>> reduced queues are possible, i.e. if the flag is set, fuse server
>>> is free to reduce number queues.
>>>
>>> Notheworth is also that a fuse-io-uring is now marked as ready
>>> after the fist queue was created.
>>>
>>> Signed-off-by: Bernd Schubert <bschubert@ddn.com>
>>> ---
>>>  fs/fuse/dev_uring.c       | 171 +++++++++++++++++++++++++++-------------------
>>>  fs/fuse/dev_uring_i.h     |   3 +
>>>  fs/fuse/inode.c           |   2 +-
>>>  include/uapi/linux/fuse.h |  10 ++-
>>>  4 files changed, 112 insertions(+), 74 deletions(-)
>>>
>>> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
>>> index 497093384c31e729053d2f5046c9ec59461ac035..d02266b483c89d105bd6301133820697f7caba9c 100644
>>> --- a/fs/fuse/dev_uring.c
>>> +++ b/fs/fuse/dev_uring.c
>>> @@ -373,6 +397,30 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,
>>>          * write_once and lock as the caller mostly doesn't take the lock at all
>>>          */
>>>         WRITE_ONCE(ring->queues[qid], queue);
>>> +
>>> +       /* Static mapping from cpu to per numa queues */
>>> +       node = cpu_to_node(qid);
>>> +       fuse_uring_cpu_qid_mapping(ring, qid, &ring->numa_q_map[node], node);
>>
>> Hi Bernd,
>>
>> I don't think we can assume node is within the bounds of numa_q_map.
>> numa_q_map gets allocated with num_online_nodes() # of entries but I
>> think the node returned in cpu_to_node() can exceed that if some nodes
>> were offline when we computed num_online_nodes() (eg num_online_nodes
>> = 2, thhe 2 online nodes are 0 and 3, while 1 and 2 are offline).
>>
>>> +
>>> +       /* global mapping */
>>> +       fuse_uring_cpu_qid_mapping(ring, qid, &ring->q_map, -1);
>>> +
>>> +       /*
>>> +        * Pairs with smp_load_acquire() in fuse_uring_select_queue().
>>> +        * Released before the per-numa bump below so that observing
>>> +        * numa_q_map[node].nr_queues > 0 implies q_map.nr_queues > 0.
>>> +        */
>>> +       smp_store_release(&ring->q_map.nr_queues,
>>> +                         ring->q_map.nr_queues + 1);
>>> +
>>> +       /*
>>> +        * smp_store_release, as the variable is read without fc->lock and
>>> +        * we need to avoid compiler re-ordering of updating the nr_queues
>>> +        * and setting ring->numa_queues[node].cpu_to_qid above
>>> +        */
>>> +       smp_store_release(&ring->numa_q_map[node].nr_queues,
>>> +                         ring->numa_q_map[node].nr_queues + 1);
>>> +
>>>         spin_unlock(&fch->lock);
>>>
>>>         return queue;
>>>
>>> @@ -1186,7 +1180,19 @@ static int fuse_uring_register(struct io_uring_cmd *cmd,
>>>         if (IS_ERR(ent))
>>>                 return PTR_ERR(ent);
>>>
>>> -       fuse_uring_do_register(ent, cmd, issue_flags);
>>> +       fuse_uring_prepare_cancel(cmd, issue_flags, ent);
>>> +       if (!READ_ONCE(ring->ready)) {
>>> +               WRITE_ONCE(fiq->ops, &fuse_io_uring_ops);
>>> +               WRITE_ONCE(ring->ready, true);
>>> +               wake_up_all(&fch->blocked_waitq);
>>> +       }
>>
>> I thought we had agreed at LSF that userspace would declare the number
>> of queues upfront and dispatch would be gated until all of them have
>> finished setup/registration rather than going ready when the first
>> entry in a queue gets registered? Did the plan change or am I
>> misremembering?
>>
>> I still have the same thoughts as previously [1] about it. I really
>> don't think we should allow requests to go through io-uring while
>> io-uring setup is still happening. If we want to add dynamic queue
>> addition in the future, we could always do that later through a new
> 
> Hi Bernd,
> 
> What do you think about dropping FUSE_URING_REDUCED_Q and reframing
> this series around dynamic queue addition instead? I don't mean to add
> more work to your plate, but my main reason is the uapi. REDUCED_Q is
> a narrow flag that's a subset of dynamic addition. Exposing general
> queue addition would line up with the decoupled queue-creation uapi
> the bufpool work will use, and it'd be more cohesive with the future
> feature to dynamically remove queues.
> 
> I think this series already has the bulk of the logic for dynamic
> addition anyways. The main missing piece looks like adding
> infrastructure to publish the mapping as an immutable RCU snapshot
> rather than mutating it in place, so a reader never sees a
> partially-built mapping.
> 
> What are your thoughts?

Except of libfuse not being ready to create queues on demand, the series
basically supports that in kernel. And I was also thinking to use CU to
update the mapping.

However, I'm lost about the relation of buf pools. I very much disagree
that adding buf pools has a relation to queues. Unless you want to make
it 2D, which gets complex to find the right queue. Reasons:

1) If I start a queue in libfuse with a 1MB buffer and later see that it
gets used, libfuse should add more buffers. However, I would not want it
to add queues, unless I see that that ring threads occupy all of the core.

2) Lowest latency is still achieved with one queue per cpu - especially
here it makes sense to have a very low buffer usage and to increase it
if needed.

3) At least one customer at DDN sets a very specific cpu configuration,
using more cores is strictly forbidden.


Thanks,
Bernd

  reply	other threads:[~2026-06-22 23:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 22:55 [PATCH v5 0/7] fuse: {io-uring} Allow to reduce the number of queues and request distribution Bernd Schubert via B4 Relay
2026-05-28 22:55 ` Bernd Schubert
2026-05-28 22:55 ` [PATCH v5 1/7] fuse: {io-uring} Add queue length counters Bernd Schubert via B4 Relay
2026-05-28 22:55   ` Bernd Schubert
2026-05-28 22:55 ` [PATCH v5 2/7] fuse: {io-uring} Rename ring->nr_queues to max_nr_queues Bernd Schubert via B4 Relay
2026-05-28 22:55   ` Bernd Schubert
2026-05-28 22:55 ` [PATCH v5 3/7] fuse: {io-uring} Use bitmaps to track registered queues Bernd Schubert via B4 Relay
2026-05-28 22:55   ` Bernd Schubert
2026-05-28 22:55 ` [PATCH v5 4/7] fuse: {io-uring} Allow reduced number of ring queues Bernd Schubert via B4 Relay
2026-05-28 22:55   ` Bernd Schubert
2026-06-13  2:24   ` Joanne Koong
2026-06-22 23:32     ` Joanne Koong
2026-06-22 23:52       ` Bernd Schubert [this message]
2026-06-23 22:10         ` Joanne Koong
2026-05-28 22:55 ` [PATCH v5 5/7] fuse: {io-uring} Queue background requests on a different core Bernd Schubert via B4 Relay
2026-05-28 22:55   ` Bernd Schubert
2026-05-28 22:55 ` [PATCH v5 6/7] fuse: {io-uring} Add retry attempts for numa local queues for load distribution Bernd Schubert via B4 Relay
2026-05-28 22:55   ` Bernd Schubert
2026-05-28 22:55 ` [PATCH v5 7/7] fuse: {io-uring} Prefer the current core over mapping Bernd Schubert via B4 Relay
2026-05-28 22:55   ` Bernd Schubert
2026-06-10 10:51 ` [PATCH v5 0/7] fuse: {io-uring} Allow to reduce the number of queues and request distribution Miklos Szeredi
2026-06-10 11:51   ` Horst Birthelmer
2026-06-10 16:33   ` Amir Goldstein
2026-06-11  2:15     ` Joanne Koong
2026-06-11  2:13   ` Joanne Koong
2026-08-14 20:55 ` David Wei
2026-08-17 21:39   ` Bernd Schubert
2026-08-19 16:12     ` David Wei
2026-08-25 21:13       ` David Wei

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=8568d20e-b00c-4902-a200-024f8cc1feba@bsbernd.com \
    --to=bernd@bsbernd.com \
    --cc=bschubert@ddn.com \
    --cc=dchg2000@gmail.com \
    --cc=fuse-devel@lists.linux.dev \
    --cc=joannelkoong@gmail.com \
    --cc=luis@igalia.com \
    --cc=miklos@szeredi.hu \
    /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.