Skip to contentSkip to conversation

io_uring/memmap: compound allocation larger than accounted region

DISCUSSION Ali Ahmet Memis 2 participants 2 messages Aug 6 io_uring

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 8 lines · Ali Ahmet Memis

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.

Signature · 1 line
Gabriel Krisman Bertazi