aboutsummaryrefslogtreecommitdiffstats
path: root/io_uring/io_uring.c
diff options
context:
space:
mode:
authorCaleb Sander Mateos <[email protected]>2025-03-04 19:48:12 +0000
committerJens Axboe <[email protected]>2025-03-05 14:38:55 +0000
commit0d83b8a9f180436a84fbdeb575696b0c3ae0ac0c (patch)
tree63f4ee653c55050eea934f788e228f0607086dbe /io_uring/io_uring.c
parentio_uring/rsrc: skip NULL file/buffer checks in io_free_rsrc_node() (diff)
downloadkernel-0d83b8a9f180436a84fbdeb575696b0c3ae0ac0c.tar.gz
kernel-0d83b8a9f180436a84fbdeb575696b0c3ae0ac0c.zip
io_uring: introduce io_cache_free() helper
Add a helper function io_cache_free() that returns an allocation to a io_alloc_cache, falling back on kfree() if the io_alloc_cache is full. This is the inverse of io_cache_alloc(), which takes an allocation from an io_alloc_cache and falls back on kmalloc() if the cache is empty. Convert 4 callers to use the helper. Signed-off-by: Caleb Sander Mateos <[email protected]> Suggested-by: Li Zetao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r--io_uring/io_uring.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index ccc343f61a57..58003fa6b327 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1422,8 +1422,7 @@ static void io_free_batch_list(struct io_ring_ctx *ctx,
if (apoll->double_poll)
kfree(apoll->double_poll);
- if (!io_alloc_cache_put(&ctx->apoll_cache, apoll))
- kfree(apoll);
+ io_cache_free(&ctx->apoll_cache, apoll);
req->flags &= ~REQ_F_POLLED;
}
if (req->flags & IO_REQ_LINK_FLAGS)