Skip to content

Commit be4f5d9

Browse files
committed
io_uring/msg_ring: use kmem_cache_free() to free request
The change adding caching around the request allocated and freed for data messages changed a kmem_cache_free() to a kfree(), which isn't correct as the request came from slab in the first place. Fix that up and use the right freeing function if the cache is already at its limit. Note that the current mixing of kmem_cache_alloc and kfree is fine, but consistent alloc/free functions should be used as it's otherwise somewhat confusing. Fixes: 50cf5f3 ("io_uring/msg_ring: add an alloc cache for io_kiocb entries") Signed-off-by: Jens Axboe <[email protected]>
1 parent b0727b1 commit be4f5d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/msg_ring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void io_msg_tw_complete(struct io_kiocb *req, struct io_tw_state *ts)
8282
spin_unlock(&ctx->msg_lock);
8383
}
8484
if (req)
85-
kfree(req);
85+
kmem_cache_free(req_cachep, req);
8686
percpu_ref_put(&ctx->refs);
8787
}
8888

0 commit comments

Comments
 (0)