]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring/kbuf: remove legacy kbuf kmem cache
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 5 Feb 2025 11:36:43 +0000 (11:36 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 17 Feb 2025 12:34:45 +0000 (05:34 -0700)
Remove the kmem cache used by legacy provided buffers.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/8195c207d8524d94e972c0c82de99282289f7f5c.1738724373.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
io_uring/io_uring.h
io_uring/kbuf.c

index e34a92c73a5d8968aea9cd0c75dfa68cfe380649..6fa1e88e40fbe44474bf837fe28b3ec2069775a7 100644 (file)
@@ -3927,8 +3927,6 @@ static int __init io_uring_init(void)
        req_cachep = kmem_cache_create("io_kiocb", sizeof(struct io_kiocb), &kmem_args,
                                SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT |
                                SLAB_TYPESAFE_BY_RCU);
-       io_buf_cachep = KMEM_CACHE(io_buffer,
-                                         SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
 
        iou_wq = alloc_workqueue("iou_exit", WQ_UNBOUND, 64);
        BUG_ON(!iou_wq);
index ab619e63ef39c89f536b0725e448d9cce2f9a09c..85bc8f76ca19092c21aba6df8d50475179c1f228 100644 (file)
@@ -418,7 +418,6 @@ static inline bool io_req_cache_empty(struct io_ring_ctx *ctx)
 }
 
 extern struct kmem_cache *req_cachep;
-extern struct kmem_cache *io_buf_cachep;
 
 static inline struct io_kiocb *io_extract_req(struct io_ring_ctx *ctx)
 {
index f152afdf0bc7483ce749a3623438e2440696fde3..2e1561c9220fef212b9a63395d6d8dd5d5aef23a 100644 (file)
@@ -20,8 +20,6 @@
 /* BIDs are addressed by a 16-bit field in a CQE */
 #define MAX_BIDS_PER_BGID (1 << 16)
 
-struct kmem_cache *io_buf_cachep;
-
 struct io_provide_buf {
        struct file                     *file;
        __u64                           addr;
@@ -411,7 +409,7 @@ void io_destroy_buffers(struct io_ring_ctx *ctx)
 
        list_for_each_safe(item, tmp, &ctx->io_buffers_cache) {
                buf = list_entry(item, struct io_buffer, list);
-               kmem_cache_free(io_buf_cachep, buf);
+               kfree(buf);
        }
 }
 
@@ -521,7 +519,7 @@ static int io_refill_buffer_cache(struct io_ring_ctx *ctx)
                spin_unlock(&ctx->completion_lock);
        }
 
-       buf = kmem_cache_alloc(io_buf_cachep, GFP_KERNEL);
+       buf = kmalloc(sizeof(*buf), GFP_KERNEL_ACCOUNT);
        if (!buf)
                return -ENOMEM;
        list_add_tail(&buf->list, &ctx->io_buffers_cache);