Re: [PATCH] io_uring: do not charge user provided SQ/CQ rings to RLIMIT_MEMLOCK

From: Hengyu Liang

Date: Fri Oct 09 2026 - 00:15:50 EST


On 10/8/26 1:11 PM, Jens Axboe wrote:
> 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...

That works for me, and the two commits look good.

I tested io_uring-7.3 at 9f0c88b7f884 as a user without CAP_IPC_LOCK and
the default 8 MiB limit. Number of objects created out of 64, with 4096
entries per ring and 32768 entries per buffer ring:

v6.13 v7.3-rc4 9f0c88b7f884
rings, io_uring_queue_init() 64 16 64
rings, io_uring_queue_init_mem() 64 21 64
buffer rings, IOU_PBUF_RING_MMAP 64 15 64
buffer rings, user memory 64 15 64

30 processes with 142 NO_MMAP rings of 64 entries each, which is what 30
PostgreSQL 18 clusters with default settings create, all get their rings.
On v7.3-rc4 7 of them do.

The per-user locked_vm count stays balanced over ring create, close and
resize and over buffer ring register and unregister. Registered buffers
and IORING_REGISTER_MEM_REGION regions are charged and refused past the
limit as before. Every liburing test gives the same result as on the
previous tip of the branch (c746673517c6).

For the buffer ring patch:

Tested-by: Hengyu Liang <hengyul@xxxxxxxxxx>