diff options
| author | Hui Peng <benquike@gmail.com> | 2026-09-19 22:17:25 +0000 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-09-21 10:52:10 -0600 |
| commit | efde156d91ba123f5db61b2b47ca94a5dd29c945 (patch) | |
| tree | 47d37c37eae83102362a97c2348881168bdd6ac8 /rust/kernel/alloc | |
| parent | 4f3c7512553344c8bc35f9e4f4d307c28ab82645 (diff) | |
io_uring/rsrc: fix accounting for cloned buffers with huge pages
Compound pages in registered buffers are accounted per ring, tracked in
ctx->hpage_acct and charged when a ring takes its first reference to a
given page. Cloning a buffer takes that reference in the destination ring
without charging for it, and io_buffer_unmap() only uncharges when it
drops the last reference to the buffer itself. Those two don't line up
once a ring drops its last reference to a compound page without also
being the last user of the buffer, and the charge for it never gets
dropped.
Charge compound pages on clone when they're new to the destination ring,
and uncharge them on unmap whenever the ring's reference count for the
page drops to zero, regardless of whether it's the last user of the
buffer. Regular pages are only charged by the registering ring, so those
still get uncharged by whoever releases the buffer last.
Fixes: df0a52537c0f ("io_uring/rsrc: add huge page accounting for registered buffers")
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
Link: https://patch.msgid.link/20260919221725.3706704-1-benquike@gmail.com
[axboe: split from original patch, and correct commit message, there is
no double un-accounting here, just a leak of the accounting]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions
