From 2f2af35f8e5a1ed552ed02e47277d50092a2b9f6 Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Thu, 13 Apr 2023 15:28:11 +0100 Subject: io_uring/rsrc: inline switch_start fast path Inline the part of io_rsrc_node_switch_start() that checks whether the cache is empty or not, as most of the times it will have some number of entries in there. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/9619c1717a0e01f22c5fce2f1ba2735f804da0f2.1681395792.git.asml.silence@gmail.com Signed-off-by: Jens Axboe --- io_uring/rsrc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'io_uring/rsrc.c') diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 5415a18844e0..bfa0b382c6c6 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -230,15 +230,13 @@ void io_rsrc_node_switch(struct io_ring_ctx *ctx, ctx->rsrc_node = backup; } -int io_rsrc_node_switch_start(struct io_ring_ctx *ctx) +int __io_rsrc_node_switch_start(struct io_ring_ctx *ctx) { - if (io_alloc_cache_empty(&ctx->rsrc_node_cache)) { - struct io_rsrc_node *node = kzalloc(sizeof(*node), GFP_KERNEL); + struct io_rsrc_node *node = kzalloc(sizeof(*node), GFP_KERNEL); - if (!node) - return -ENOMEM; - io_alloc_cache_put(&ctx->rsrc_node_cache, &node->cache); - } + if (!node) + return -ENOMEM; + io_alloc_cache_put(&ctx->rsrc_node_cache, &node->cache); return 0; } -- cgit