All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>,
	io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/1] io_uring: optimise sqe-to-req flags translation
Date: Sun, 19 Jan 2020 10:36:43 -0700	[thread overview]
Message-ID: <7176fd92-9bb4-1017-2b8f-3deaefa41ddd@kernel.dk> (raw)
In-Reply-To: <8ce8fffb-f02c-8d0d-4b22-626742f1a852@gmail.com>

On 1/19/20 12:46 AM, Pavel Begunkov wrote:
> On 18/01/2020 23:46, Jens Axboe wrote:
>> On 1/18/20 10:22 AM, Pavel Begunkov wrote:
>>> For each IOSQE_* flag there is a corresponding REQ_F_* flag. And there
>>> is a repetitive pattern of their translation:
>>> e.g. if (sqe->flags & SQE_FLAG*) req->flags |= REQ_F_FLAG*
>>>
>>> Use same numeric values/bits for them and copy instead of manual
>>> handling.
> 
> I wonder, why this isn't a common practice around the kernel. E.g. I'm
> looking at iocb_flags() and kiocb_set_rw_flags(), and their one by one
> flags copying is just wasteful.

If I were to guess, I'd assume that it's due to continually adding flags
one at the time. For the first flag, it's not a big deal. If you end up
with a handful or more, it's clearly much better to have them occupy the
same space and avoid lots of branches checking and setting matching
flags.

You should send in patches for IOCB flags.

-- 
Jens Axboe


  reply	other threads:[~2020-01-19 17:36 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
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 [this message]
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 \
    --in-reply-to=7176fd92-9bb4-1017-2b8f-3deaefa41ddd@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@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.