Re: replace sq_mask with ring_mask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux