Skip to content

Commit 5dbcad5

Browse files
isilenceaxboe
authored andcommitted
io_uring: don't miscount pinned memory
io_sqe_buffer_unregister() uses cxt->sqo_mm for memory accounting, but io_ring_ctx_free() drops ->sqo_mm before leaving pinned_vm over-accounted. Postpone mm cleanup for when it's not needed anymore. Fixes: 3097582 ("io_uring: report pinned memory usage") Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 7fbb1b5 commit 5dbcad5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7670,12 +7670,12 @@ static void io_destroy_buffers(struct io_ring_ctx *ctx)
76707670
static void io_ring_ctx_free(struct io_ring_ctx *ctx)
76717671
{
76727672
io_finish_async(ctx);
7673+
io_sqe_buffer_unregister(ctx);
76737674
if (ctx->sqo_mm) {
76747675
mmdrop(ctx->sqo_mm);
76757676
ctx->sqo_mm = NULL;
76767677
}
76777678

7678-
io_sqe_buffer_unregister(ctx);
76797679
io_sqe_files_unregister(ctx);
76807680
io_eventfd_unregister(ctx);
76817681
io_destroy_buffers(ctx);

0 commit comments

Comments
 (0)