diff options
| author | Hengyu Liang <hengyul@cs.unc.edu> | 2026-10-06 08:57:32 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-10-08 13:07:38 -0600 |
| commit | b59cabf9b4acb65f3f9968087ca0e18010d85076 (patch) | |
| tree | b96b8138447ea250ae4932cf6298671d4375861d /scripts/Makefile.thinlto | |
| parent | a92193c91e8839fe5fc209616ea95465ae4b919d (diff) | |
| download | linux-next-b59cabf9b4acb65f3f9968087ca0e18010d85076.tar.gz linux-next-b59cabf9b4acb65f3f9968087ca0e18010d85076.zip | |
io_uring: do not charge the SQ/CQ rings to RLIMIT_MEMLOCK
Commit 8078486e1d53 ("io_uring: use region api for SQ") and commit
81a4058e0cd0 ("io_uring: use region api for CQ") made io_uring_setup()
allocate the rings with io_create_region().
However, io_create_region() charges the memory to RLIMIT_MEMLOCK, and
the rings had been exempt from that limit since commit 26bfa89e25f4
("io_uring: place ring SQ/CQ arrays under memcg memory limits"). As of
now, a user without CAP_IPC_LOCK gets ENOMEM from io_uring_setup() when
their rings exceed the limit, which is 8 MiB by default. PostgreSQL
developers have already hit this in their io_uring tests [1].
The issue can be reproduced with a simple liburing program, run as an
unprivileged user:
#include <liburing.h>
#include <stdio.h>
int main(void)
{
static struct io_uring ring[64];
int i;
for (i = 0; i < 64; i++)
if (io_uring_queue_init(4096, &ring[i], 0) < 0)
break;
printf("%d rings\n", i);
return 0;
}
Before those commits (v6.13), it prints "64 rings". After those commits
(v6.14), it prints "21 rings".
This patch makes io_create_region() take the user to charge, and passes
no user for the SQ/CQ rings.
Link: https://www.postgresql.org/message-id/flat/667f7dcf-404b-4898-a426-57ca6e0617f6@gmail.com [1]
Fixes: 8078486e1d53 ("io_uring: use region api for SQ")
Fixes: 81a4058e0cd0 ("io_uring: use region api for CQ")
Cc: stable@vger.kernel.org
Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
Link: https://lore.kernel.org/io-uring/20261006125732.3425762-1-hengyul@cs.unc.edu/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
