summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-06-06 21:25:01 +0300
committerJens Axboe <axboe@kernel.dk>2024-06-24 17:39:55 +0300
commit50cf5f3842af3135b88b041890e7e12a74425fcb (patch)
tree7c7f4035cbb6be7a747f264693345235fc64ee52 /include/linux
parent0617bb500bfabf8447062f1e1edde92ed2b638f1 (diff)
downloadlinux-50cf5f3842af3135b88b041890e7e12a74425fcb.tar.xz
io_uring/msg_ring: add an alloc cache for io_kiocb entries
With slab accounting, allocating and freeing memory has considerable overhead. Add a basic alloc cache for the io_kiocb allocations that msg_ring needs to do. Unlike other caches, this one is used by the sender, grabbing it from the remote ring. When the remote ring gets the posted completion, it'll free it locally. Hence it is separately locked, using ctx->msg_lock. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/io_uring_types.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
index 1052a68fd68d..ede42dce1506 100644
--- a/include/linux/io_uring_types.h
+++ b/include/linux/io_uring_types.h
@@ -397,6 +397,9 @@ struct io_ring_ctx {
struct callback_head poll_wq_task_work;
struct list_head defer_list;
+ struct io_alloc_cache msg_cache;
+ spinlock_t msg_lock;
+
#ifdef CONFIG_NET_RX_BUSY_POLL
struct list_head napi_list; /* track busy poll napi_id */
spinlock_t napi_lock; /* napi_list lock */