Skip to content

Commit fbbb8e9

Browse files
committed
io_uring/rsrc: get rid of io_rsrc_node allocation cache
It's not going to be needed in the fast path going forward, so kill it off. Signed-off-by: Jens Axboe <[email protected]>
1 parent 7029acd commit fbbb8e9

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

include/linux/io_uring_types.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,6 @@ struct io_ring_ctx {
370370
struct io_rsrc_data *file_data;
371371
struct io_rsrc_data *buf_data;
372372

373-
/* protected by ->uring_lock */
374-
struct io_alloc_cache rsrc_node_cache;
375-
376373
u32 pers_next;
377374
struct xarray personalities;
378375

io_uring/io_uring.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,7 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
312312
INIT_LIST_HEAD(&ctx->sqd_list);
313313
INIT_LIST_HEAD(&ctx->cq_overflow_list);
314314
INIT_LIST_HEAD(&ctx->io_buffers_cache);
315-
ret = io_alloc_cache_init(&ctx->rsrc_node_cache, IO_NODE_ALLOC_CACHE_MAX,
316-
sizeof(struct io_rsrc_node));
317-
ret |= io_alloc_cache_init(&ctx->apoll_cache, IO_POLL_ALLOC_CACHE_MAX,
315+
ret = io_alloc_cache_init(&ctx->apoll_cache, IO_POLL_ALLOC_CACHE_MAX,
318316
sizeof(struct async_poll));
319317
ret |= io_alloc_cache_init(&ctx->netmsg_cache, IO_ALLOC_CACHE_MAX,
320318
sizeof(struct io_async_msghdr));
@@ -358,7 +356,6 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
358356
free_ref:
359357
percpu_ref_exit(&ctx->refs);
360358
err:
361-
io_alloc_cache_free(&ctx->rsrc_node_cache, kfree);
362359
io_alloc_cache_free(&ctx->apoll_cache, kfree);
363360
io_alloc_cache_free(&ctx->netmsg_cache, io_netmsg_cache_free);
364361
io_alloc_cache_free(&ctx->rw_cache, io_rw_cache_free);
@@ -2740,7 +2737,6 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx)
27402737

27412738
WARN_ON_ONCE(!list_empty(&ctx->ltimeout_list));
27422739

2743-
io_alloc_cache_free(&ctx->rsrc_node_cache, kfree);
27442740
if (ctx->mm_account) {
27452741
mmdrop(ctx->mm_account);
27462742
ctx->mm_account = NULL;

io_uring/rsrc.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <uapi/linux/io_uring.h>
1414

1515
#include "io_uring.h"
16-
#include "alloc_cache.h"
1716
#include "openclose.h"
1817
#include "rsrc.h"
1918
#include "memmap.h"
@@ -129,16 +128,12 @@ struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx, int type)
129128
{
130129
struct io_rsrc_node *node;
131130

132-
node = io_alloc_cache_get(&ctx->rsrc_node_cache);
133-
if (!node) {
134-
node = kzalloc(sizeof(*node), GFP_KERNEL);
135-
if (!node)
136-
return NULL;
131+
node = kzalloc(sizeof(*node), GFP_KERNEL);
132+
if (node) {
133+
node->ctx = ctx;
134+
node->refs = 1;
135+
node->type = type;
137136
}
138-
139-
node->ctx = ctx;
140-
node->refs = 1;
141-
node->type = type;
142137
return node;
143138
}
144139

@@ -487,8 +482,7 @@ void io_free_rsrc_node(struct io_rsrc_node *node)
487482
break;
488483
}
489484

490-
if (!io_alloc_cache_put(&ctx->rsrc_node_cache, node))
491-
kfree(node);
485+
kfree(node);
492486
}
493487

494488
static void __io_sqe_files_unregister(struct io_ring_ctx *ctx)

0 commit comments

Comments
 (0)