* 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, other threads:[~2019-05-16 14:50 UTC | newest]
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
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.