Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* replace sq_mask with ring_mask
@ 2019-05-15  6:47 JackieLiu
  2019-05-16 14:50 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: JackieLiu @ 2019-05-15  6:47 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

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.

Jackie Liu


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: replace sq_mask with ring_mask
  2019-05-15  6:47 replace sq_mask with ring_mask JackieLiu
@ 2019-05-16 14:50 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-05-16 14:50 UTC (permalink / raw)
  To: JackieLiu; +Cc: linux-block

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15  6:47 replace sq_mask with ring_mask JackieLiu
2019-05-16 14:50 ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox