io_uring: introduce io_cache_free() helper
authorCaleb Sander Mateos <csander@purestorage.com>
Tue, 4 Mar 2025 19:48:12 +0000 (12:48 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 5 Mar 2025 14:38:55 +0000 (07:38 -0700)
commit0d83b8a9f180436a84fbdeb575696b0c3ae0ac0c
tree63f4ee653c55050eea934f788e228f0607086dbe
parentfe21a4532ef2a6852c89b352cb8ded0d37b4745c
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>
io_uring/alloc_cache.h
io_uring/futex.c
io_uring/io_uring.c
io_uring/rsrc.c