Linux io-uring development
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Bernd Schubert <bernd.schubert@fastmail.fm>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Ming Lei <tom.leiming@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	io-uring@vger.kernel.org, Joanne Koong <joannelkoong@gmail.com>,
	Josef Bacik <josef@toxicpanda.com>
Subject: Re: Large CQE for fuse headers
Date: Mon, 14 Oct 2024 14:34:45 +0100	[thread overview]
Message-ID: <ab2d2f5c-0e76-44a2-8a7e-6f9edcfa5a92@gmail.com> (raw)
In-Reply-To: <b284b6a2-8837-4779-b6a2-f31196aea7b9@fastmail.fm>

On 10/14/24 13:47, Bernd Schubert wrote:
> On 10/14/24 13:10, Miklos Szeredi wrote:
>> On Mon, 14 Oct 2024 at 04:44, Ming Lei <tom.leiming@gmail.com> wrote:
>>
>>> It also depends on how fuse user code consumes the big CQE payload, if
>>> fuse header needs to keep in memory a bit long, you may have to copy it
>>> somewhere for post-processing since io_uring(kernel) needs CQE to be
>>> returned back asap.
>>
>> Yes.
>>
>> I'm not quite sure how the libfuse interface will work to accommodate
>> this.  Currently if the server needs to delay the processing of a
>> request it would have to copy all arguments, since validity will not
>> be guaranteed after the callback returns.  With the io_uring
>> infrastructure the headers would need to be copied, but the data
>> buffer would be per-request and would not need copying.  This is
>> relaxing a requirement so existing servers would continue to work
>> fine, but would not be able to take full advantage of the multi-buffer
>> design.
>>
>> Bernd do you have an idea how this would work?
> 
> I assume returning a CQE is io_uring_cq_advance()?

Yes

> In my current libfuse io_uring branch that only happens when
> all CQEs have been processed. We could also easily switch to
> io_uring_cqe_seen() to do it per CQE.

Either that one.

> I don't understand why we need to return CQEs asap, assuming CQ
> ring size is the same as SQ ring size - why does it matter?

The SQE is consumed once the request is issued, but nothing
prevents the user to keep the QD larger than the SQ size,
e.g. do M syscalls each ending N requests and then wait for
N * M completions.

> If we indeed need to return the CQE before processing the request,
> it indeed would be better to have a 2nd memory buffer associated with
> the fuse request.

With that said, the usual problem is to size the CQ so that it
(almost) never overflows, otherwise it hurts performance. With
DEFER_TASKRUN you can delay returning CQEs to the kernel until
the next time you wait for completions, i.e. do io_uring waiting
syscall. Without the flag, CQEs may come asynchronously to the
user, so need a bit more consideration.

-- 
Pavel Begunkov

  reply	other threads:[~2024-10-14 13:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10 20:56 Large CQE for fuse headers Bernd Schubert
2024-10-11 17:57 ` Jens Axboe
2024-10-11 18:35   ` Bernd Schubert
2024-10-11 18:39     ` Jens Axboe
2024-10-11 19:03       ` Bernd Schubert
2024-10-11 19:24         ` Jens Axboe
2024-10-11 21:38 ` Pavel Begunkov
2024-10-12  1:55 ` Ming Lei
2024-10-12 14:38   ` Jens Axboe
2024-10-13 21:20     ` Bernd Schubert
2024-10-14  2:44       ` Ming Lei
2024-10-14 11:10         ` Miklos Szeredi
2024-10-14 12:47           ` Bernd Schubert
2024-10-14 13:34             ` Pavel Begunkov [this message]
2024-10-14 15:21               ` Bernd Schubert
2024-10-14 17:48                 ` Pavel Begunkov
2024-10-14 21:27                   ` Bernd Schubert
2024-10-16 10:54                     ` Miklos Szeredi
2024-10-16 11:53                       ` Bernd Schubert
2024-10-16 12:24                         ` Miklos Szeredi
2024-10-17  0:59                         ` Ming Lei
2024-10-14 13:20           ` Bernd Schubert
2024-10-14 10:31       ` Miklos Szeredi

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=ab2d2f5c-0e76-44a2-8a7e-6f9edcfa5a92@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bernd.schubert@fastmail.fm \
    --cc=io-uring@vger.kernel.org \
    --cc=joannelkoong@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=miklos@szeredi.hu \
    --cc=tom.leiming@gmail.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