The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* io_uring/memmap: compound allocation larger than accounted region
@ 2026-08-06 15:42 Ali Ahmet Memis
  2026-08-06 16:21 ` Gabriel Krisman Bertazi
  0 siblings, 1 reply; 2+ messages in thread
From: Ali Ahmet Memis @ 2026-08-06 15:42 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Pavel Begunkov, io-uring, linux-kernel

io_mem_alloc_compound() allocates get_order(size) pages, while
io_create_region() accounts reg->size >> PAGE_SHIFT. For a ring with 4096 SQ
entries and the default CQ size that is 64 pages allocated against 37
accounted.

Is that intentional? memcg charges the full allocation, so only RLIMIT_MEMLOCK
undercounts, and the gap is bounded by 2x. I did not want to send a patch for
something that may well be a deliberate trade for the single folio.

Thanks,
Ali

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: io_uring/memmap: compound allocation larger than accounted region
  2026-08-06 15:42 io_uring/memmap: compound allocation larger than accounted region Ali Ahmet Memis
@ 2026-08-06 16:21 ` Gabriel Krisman Bertazi
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Krisman Bertazi @ 2026-08-06 16:21 UTC (permalink / raw)
  To: Ali Ahmet Memis, Jens Axboe; +Cc: Pavel Begunkov, io-uring, linux-kernel

Ali Ahmet Memis <ali@iusegentoo.com> writes:

> io_mem_alloc_compound() allocates get_order(size) pages, while
> io_create_region() accounts reg->size >> PAGE_SHIFT. For a ring with 4096 SQ
> entries and the default CQ size that is 64 pages allocated against 37
> accounted.
>
> Is that intentional? memcg charges the full allocation, so only RLIMIT_MEMLOCK
> undercounts, and the gap is bounded by 2x. I did not want to send a patch for
> something that may well be a deliberate trade for the single folio.

I don't think that is intentional, beyond a simplification of the
code.  If it is, it seems like a bad idea. Not necessarily harmful in
itself, but we should be accounting properly and not doing it if it goes
above the rlimit.

-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-06 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 15:42 io_uring/memmap: compound allocation larger than accounted region Ali Ahmet Memis
2026-08-06 16:21 ` Gabriel Krisman Bertazi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox