Re: [PATCH] io_uring: do not charge user provided SQ/CQ rings to RLIMIT_MEMLOCK
From: Jens Axboe
Date: Thu Oct 08 2026 - 15:11:26 EST
On 10/8/26 11:06 AM, Hengyu Liang wrote:
> This goes on top of io_uring-7.3 (c746673517c6), as discussed in [2].
>
> Tested on that branch as a user without CAP_IPC_LOCK and the default
> 8 MiB limit:
>
> before after
> program above 21 64
> the same with io_uring_queue_init() 64 64
> 30 processes x 142 NO_MMAP rings of 64 entries 7 30
>
> The last row is what 30 PostgreSQL 18 clusters with default settings
> create. The number is how many of them got all their rings.
>
> The per-user locked_vm count stays balanced over ring create, close and
> resize. Provided buffer rings and IORING_REGISTER_MEM_REGION regions on
> user memory are charged as before. Every liburing test gives the same
> result with and without the patch.
>
> Not changed here: provided buffer rings on user memory, which is what
> io_uring_setup_buf_ring() registers, were not charged in v6.13 either
> (64 of 64 rings of 32768 entries then, 16 now). I can send a patch for
> those as well if you want them handled the same way.
Honestly, after taking a closer look at this, I think we're better off
with your original patch and one on top for pbuf rings. Please check:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git/log/?h=io_uring-7.3
for the top 2 commits. If you can re-test one more time, that'd be
great...
--
Jens Axboe