linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: JackieLiu <liuyun01@kylinos.cn>
Cc: linux-block@vger.kernel.org
Subject: Re: replace sq_mask with ring_mask
Date: Thu, 16 May 2019 08:50:33 -0600	[thread overview]
Message-ID: <eea42825-8186-ab15-3bcc-4b05cbe33409@kernel.dk> (raw)
In-Reply-To: <820102D0-D768-4E39-A9FE-FB75A53FEE8F@kylinos.cn>

On 5/15/19 12:47 AM, JackieLiu wrote:
> Hello Jens Axboe
> 
> Could we replace ctx->sq_mask/ctx->cq_mask with cq_ring->ring_mask
> /sq_ring->ring_mask ? because it’s a constant and never change in 
> io_uring.c
> 
> I found that ctx->sq_mask just used on 
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/io_uring.c?h=v5.1#n1831
> 
> and we can replace like follow:
> 
> - head = READ_ONCE(ring->array[head & ctx->sq_mask]);
> + head = READ_ONCE(ring->array[head & ring->ring_mask]);
> 
> If I understand incorrectly, please point out.

We could, but we cache it in the kernel since the ring value could
potentially be modified by the application.

-- 
Jens Axboe


      reply	other threads:[~2019-05-16 14:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15  6:47 replace sq_mask with ring_mask JackieLiu
2019-05-16 14:50 ` Jens Axboe [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=eea42825-8186-ab15-3bcc-4b05cbe33409@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=liuyun01@kylinos.cn \
    /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;
as well as URLs for NNTP newsgroup(s).