public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>,
	Gabriel Krisman Bertazi <krisman@suse.de>
Cc: io-uring@vger.kernel.org
Subject: Re: [PATCH liburing 1/1] man: add io_uring_register_region.3
Date: Wed, 14 Jan 2026 16:53:21 -0700	[thread overview]
Message-ID: <988a3d72-a58b-45a4-8d98-8928de4f3ecf@kernel.dk> (raw)
In-Reply-To: <d8f24928-bcc8-4772-a9b2-d6d5d1bbca72@gmail.com>

On 1/14/26 11:50 AM, Pavel Begunkov wrote:
> On 1/14/26 17:23, Jens Axboe wrote:
>> On 1/14/26 9:04 AM, Pavel Begunkov wrote:
>>> On 1/14/26 14:54, Pavel Begunkov wrote:
>>>> On 1/14/26 14:42, Pavel Begunkov wrote:
>>>>> On 1/13/26 22:37, Jens Axboe wrote:
>>>>>> On 1/13/26 2:31 PM, Gabriel Krisman Bertazi wrote:
>>>>>>> Pavel Begunkov <asml.silence@gmail.com> writes:
>>>>>>>
>>>>>>>> Describe the region API. As it was created for a bunch of ideas in mind,
>>>>>>>> it doesn't go into details about wait argument passing, which I assume
>>>>>>>> will be a separate page the region description can refer to.
>>>>>>>>
>>>>>>>
>>>>>>> Hey, Pavel.
>>>>>>
>>>>>> I did a bunch of spelling and phrasing fixups when applying, can you
>>>>>> take a look at the repo and send a patch for the others? Thanks!
>>>>>
>>>>> "Upon successful completion, the memory region may then be used, for
>>>>> example, to pass waiting parameters to the io_uring_enter(2) system
>>>>> call in a more efficient manner as it avoids copying wait related data
>>>>> for each wait event."
>>>>>
>>>>> Doesn't matter much, but this change is somewhat misleading. Both copy
>>>>> args same number of times (i.e. unsafe_get_user() instead of
>>>>> copy_from_user()), which is why I was a bit vague with that
>>>>> "in an efficient manner".
>>>>
>>>> Hmm, actually the normal / non-registered way does make an extra
>>>> copy, even though it doesn't have to.
>>>
>>> And the compiler is smart enough to optimise it out since
>>> it's all on stack.
>>
>> Not sure I follow these emails. For the normal case,
>> io_validate_ext_arg() copies in the args via a normal user copy, which
>> depending on options and the arch (or even sub-arch, amd more expensive)
>> is more or less expensive.
> 
> In the end, after prep that is still just a move instruction, e.g.
> for x86. And it loads into a register and stores it into ext_arg,
> just like with registration. User copy needs to prepare page fault
> handling / etc., which could be costly (e.g. I see stac + lfence
> in asm), but that's not exactly about avoiding copies.

Those are implementation details. The user copy is stac/clac, and then
the loads. This is what makes it more expensive. I don't want to be
writing about stac/clac in the man page, that's irrelevant to the user.

-- 
Jens Axboe

  reply	other threads:[~2026-01-14 23:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 20:05 [PATCH liburing 1/1] man: add io_uring_register_region.3 Pavel Begunkov
2026-01-13 20:35 ` Jens Axboe
2026-01-13 21:31 ` Gabriel Krisman Bertazi
2026-01-13 22:37   ` Jens Axboe
2026-01-14 14:42     ` Pavel Begunkov
2026-01-14 14:54       ` Pavel Begunkov
2026-01-14 16:04         ` Pavel Begunkov
2026-01-14 17:23           ` Jens Axboe
2026-01-14 18:50             ` Pavel Begunkov
2026-01-14 23:53               ` Jens Axboe [this message]
2026-01-15 13:06                 ` Pavel Begunkov
2026-01-15 14:14                   ` Jens Axboe
2026-01-15 17:19                     ` Pavel Begunkov
2026-01-14 14:30   ` Pavel Begunkov

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=988a3d72-a58b-45a4-8d98-8928de4f3ecf@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=krisman@suse.de \
    /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