mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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 <csander@purestorage.com> Suggested-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/20250304194814.2346705-1-csander@purestorage.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
fe21a4532e
commit
0d83b8a9f1
@@ -53,12 +53,10 @@ static void __io_futex_complete(struct io_kiocb *req, io_tw_token_t tw)
|
||||
|
||||
static void io_futex_complete(struct io_kiocb *req, io_tw_token_t tw)
|
||||
{
|
||||
struct io_futex_data *ifd = req->async_data;
|
||||
struct io_ring_ctx *ctx = req->ctx;
|
||||
|
||||
io_tw_lock(ctx, tw);
|
||||
if (!io_alloc_cache_put(&ctx->futex_cache, ifd))
|
||||
kfree(ifd);
|
||||
io_cache_free(&ctx->futex_cache, req->async_data);
|
||||
__io_futex_complete(req, tw);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user