From: Bernd Schubert <bernd@bsbernd.com>
To: Miklos Szeredi <miklos@szeredi.hu>,
Joanne Koong <joannelkoong@gmail.com>
Cc: hbirthelmer@ddn.com, linux-fsdevel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] fuse: fix io-uring background queue dispatch on request completion
Date: Thu, 16 Apr 2026 16:54:35 +0200 [thread overview]
Message-ID: <755d8408-6b1c-4e0b-9528-4769e8cf7fe1@bsbernd.com> (raw)
In-Reply-To: <CAJfpegungbDJ57MJnLACuzKEqCDOBgPH0WzZ+9Pt3FJHDaCBGQ@mail.gmail.com>
On 4/16/26 16:43, Miklos Szeredi wrote:
> On Wed, 8 Apr 2026 at 19:28, Joanne Koong <joannelkoong@gmail.com> wrote:
>>
>> When a background request completes via the io_uring path, the
>> background queue gets flushed to dispatch pending background requests,
>> but this is done before the connection-level background counters
>> (fc->num_background, fc->active_background) are properly accounted,
>> which may reduce effective queue depth to one.
>>
>> The connection-level counters are decremented in fuse_request_end(), but
>> flush_bg_queue() flushes the /dev/fuse path queue (fc->bg_queue), not
>> the io_uring per-queue bg one, which means pending uring background
>> requests on the queue are never dispatched in this path.
>>
>> Fix this by accounting the connection-level background counters first
>> before flushing the queue's background queue. Since
>> fuse_request_bg_finish() clears FR_BACKGROUND, fuse_request_end() will
>> skip the background cleanup branch entirely, which avoids any
>> double-decrements; it will call the wake_up(&req->waitq) branch but this
>> is effectively a no-op as background requests have no waiters on
>> req->waitq.
>
> Does this guarantee progress if there are still requests on
> fc->bg_queue at the point when ring becomes ready?
Request allocation is still blocked until the ring is set to ready -
there should be no background requests at all.
There were a couple of issues with dynamic switching from /dev/fuse to
fuse-io-uring, a really hard one was a lock order change. I think once
we have reduced queues merged, I'm to create an additional patch set
which allow allow distribution of requests between queues. The initial
series had that, but Joanne had concerns. Anyway, once we have
distribution between queues, we can avoid the global bg lock and global
bg limit and set that per queue. If I remember right, that would solve
the lock order issue. Although I forgot the exact details. Wish I would
have creates notes or a blog - too late now :(
>
> Seems so, because there must be at least one background request on the
> regular request queues if bg_queue is non-empty, and when that is
> finished, a new one will be put on the pending queue, and so on until
> bg_queue becomes empty.
Yeah, in order to avoid stalls, ring queues always allow one bg request,
ignoring the global limit.
>
> Maybe add a comment about this subtlety?
Where should that comment be?
Thanks,
Bernd
prev parent reply other threads:[~2026-04-16 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 17:25 [PATCH v2] fuse: fix io-uring background queue dispatch on request completion Joanne Koong
2026-04-16 14:43 ` Miklos Szeredi
2026-04-16 14:54 ` Bernd Schubert [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=755d8408-6b1c-4e0b-9528-4769e8cf7fe1@bsbernd.com \
--to=bernd@bsbernd.com \
--cc=hbirthelmer@ddn.com \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=stable@vger.kernel.org \
/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.