Skip to content

Commit 02b8d41

Browse files
committed
io_uring/rsrc: use kvfree() for the imu cache
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 <[email protected]>
1 parent 53262c9 commit 02b8d41

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

io_uring/alloc_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static inline void *io_cache_alloc(struct io_alloc_cache *cache, gfp_t gfp)
6464
static inline void io_cache_free(struct io_alloc_cache *cache, void *obj)
6565
{
6666
if (!io_alloc_cache_put(cache, obj))
67-
kfree(obj);
67+
kvfree(obj);
6868
}
6969

7070
#endif

io_uring/rsrc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ bool io_rsrc_cache_init(struct io_ring_ctx *ctx)
168168
void io_rsrc_cache_free(struct io_ring_ctx *ctx)
169169
{
170170
io_alloc_cache_free(&ctx->node_cache, kfree);
171-
io_alloc_cache_free(&ctx->imu_cache, kfree);
171+
io_alloc_cache_free(&ctx->imu_cache, kvfree);
172172
}
173173

174174
static void io_clear_table_tags(struct io_rsrc_data *data)

0 commit comments

Comments
 (0)