Re: [PATCH] io_uring: keep memlock accounting while regions are mapped

From: Jens Axboe

Date: Tue Aug 25 2026 - 13:53:07 EST


On 8/16/26 1:07 AM, Marina via B4 Relay wrote:
> From: Marina <dejamarina@xxxxxxxxx>
>
> io_uring unaccounts kernel-allocated SQ/CQ and SQE regions when resize
> replaces them, even if existing VMAs still retain their pages. Repeating
> mmap and resize can therefore retain memory beyond RLIMIT_MEMLOCK.
>
> Move each charge to a refcounted record owned by the active region and its
> MMU or NOMMU mappings. Release it after both the region and final VMA are
> gone. Keep direct accounting for user-provided regions, which cannot be
> mapped through the io_uring file.
>
> Accounting stays region-granular, so a partial mapping retains the complete
> region charge.

Patch doesn't apply to the current tree at all. Please send an updated
one, if needed.

--
Jens Axboe