From: Jens Axboe <[email protected]>
To: Pavel Begunkov <[email protected]>,
[email protected], [email protected]
Subject: Re: [PATCH 0/2] optimise sqe-to-req flags
Date: Fri, 17 Jan 2020 17:16:57 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 1/17/20 4:14 PM, Pavel Begunkov wrote:
> On 18/01/2020 01:49, Jens Axboe wrote:
>> On 1/17/20 3:41 PM, Pavel Begunkov wrote:
>>> *lost the cover-letter, but here we go*
>>>
>>> The main idea is to optimise code like the following by directly
>>> copying sqe flags:
>>>
>>> if (sqe_flags & IOSQE_IO_HARDLINK)
>>> req->flags |= REQ_F_HARDLINK;
>>>
>>> The first patch is a minor cleanup, and the second one do the
>>> trick. No functional changes.
>>>
>>> The other thing to consider is whether to use such flags as
>>> REQ_F_LINK = IOSQE_IO_LINK, or directly use IOSQE_IO_LINK instead.
>>
>> I think we should keep the names separate. I think it looks fine, though
>> I do wish that we could just have both in an enum and not have to do
>> weird naming. We sometimes do:
>>
>> enum {
>> __REQ_F_FOO
>> };
>>
>> #define REQ_F_FOO (1U << __REQ_F_FOO)
>>
>
> I thought it will be too bulky as it needs retyping the same name many
> times. Though, it solves numbering problem and is less error-prone
> indeed. Let me to play with it a bit.
It's less error prone once the change is done, though the change will be
bigger. I think that's the right tradeoff.
> BTW, there is another issue from development perspective -- it's
> harder to find from where a flag is came. E.g. search for REQ_F_FOO
> won't give you a place, where it was set. SQE_INHERITED_FLAGS is close
> in the code to its usage exactly
> for this reason.
Since it's just that one spot, add a comment with the flag names or get
rid of the SQE_INHERITED_FLAGS define. That'll make it easy to find.
>> and with that we could have things Just Work in terms of numbering, if
>> we keep the overlapped values at the start. Would need IOSQE_* to also
>> use an enum, ala:
>>
>> enum {
>> __IOSQE_FIXED_FILE,
>> __IOSQE_IO_DRAIN,
>> ...
>> };
>>
>
> I tried to not modify the userspace header. Wouldn't it be better to
> add _BIT postfix instead of the underscores?
No strong preference, I usually do the underscores, but not a big deal
to me. There's also BIT_* helpers to make the masks, we should use
those.
--
Jens Axboe
next prev parent reply other threads:[~2020-01-18 0:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 22:22 [PATCH 1/2] io_uring: remove REQ_F_IO_DRAINED Pavel Begunkov
2020-01-17 22:22 ` [PATCH 2/2] io_uring: optimise sqe-to-req flags translation Pavel Begunkov
2020-01-17 22:41 ` [PATCH 0/2] optimise sqe-to-req flags Pavel Begunkov
2020-01-17 22:49 ` Jens Axboe
2020-01-17 23:14 ` Pavel Begunkov
2020-01-18 0:16 ` Jens Axboe [this message]
2020-01-18 10:24 ` [PATCH v2] io_uring: optimise sqe-to-req flags translation Pavel Begunkov
2020-01-18 16:34 ` Jens Axboe
2020-01-18 17:10 ` Pavel Begunkov
2020-01-18 17:22 ` [PATCH v3 1/1] " Pavel Begunkov
2020-01-18 20:46 ` Jens Axboe
2020-01-19 7:46 ` Pavel Begunkov
2020-01-19 17:36 ` Jens Axboe
2020-01-18 20:45 ` [PATCH v2] " Jens Axboe
2020-01-17 22:50 ` [PATCH 1/2] io_uring: remove REQ_F_IO_DRAINED Jens Axboe
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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