]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring/rsrc: use kvfree() for the imu cache
authorJens Axboe <axboe@kernel.dk>
Mon, 20 Apr 2026 19:15:41 +0000 (13:15 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Apr 2026 18:19:01 +0000 (12:19 -0600)
Currently anything that requires kvmalloc_flex() for allocations will
not get re-cached, and hence the cache freeing path is correct in that
it always uses kfree() to free the allocated memory. But this seems a
bit fragile as it's something that could get mix should that situation
change, so switch io_free_imu() and io_alloc_cache_free() to use kvfree
as the desctructor.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/alloc_cache.h
io_uring/rsrc.c

index 45fcd8b3b824bc061b27ef67999acabb996bd25a..962b6e2d04cc5878c7b0888e1e641bb92cb7cd86 100644 (file)
@@ -64,7 +64,7 @@ static inline void *io_cache_alloc(struct io_alloc_cache *cache, gfp_t gfp)
 static inline void io_cache_free(struct io_alloc_cache *cache, void *obj)
 {
        if (!io_alloc_cache_put(cache, obj))
-               kfree(obj);
+               kvfree(obj);
 }
 
 #endif
index c042054c3b5f415f4973859cf277aeb347d784d4..650303626be6ed54d661ac88cd942095a79a2603 100644 (file)
@@ -168,7 +168,7 @@ bool io_rsrc_cache_init(struct io_ring_ctx *ctx)
 void io_rsrc_cache_free(struct io_ring_ctx *ctx)
 {
        io_alloc_cache_free(&ctx->node_cache, kfree);
-       io_alloc_cache_free(&ctx->imu_cache, kfree);
+       io_alloc_cache_free(&ctx->imu_cache, kvfree);
 }
 
 static void io_clear_table_tags(struct io_rsrc_data *data)