Skip to content

Commit d9713ad

Browse files
isilenceaxboe
authored andcommitted
io_uring: remove async request cache
io_req_complete_post() was a sole user of ->locked_free_list, but since we just gutted the function, the cache is not used anymore and can be removed. ->locked_free_list served as an asynhronous counterpart of the main request (i.e. struct io_kiocb) cache for all unlocked cases like io-wq. Now they're all forced to be completed into the main cache directly, off of the normal completion path or via io_free_req(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/7bffccd213e370abd4de480e739d8b08ab6c1326.1712331455.git.asml.silence@gmail.com Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent de96e9a commit d9713ad

2 files changed

Lines changed: 0 additions & 26 deletions

File tree

include/linux/io_uring_types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,6 @@ struct io_ring_ctx {
346346

347347
spinlock_t completion_lock;
348348

349-
/* IRQ completion list, under ->completion_lock */
350-
unsigned int locked_free_nr;
351-
struct io_wq_work_list locked_free_list;
352-
353349
struct list_head io_buffers_comp;
354350
struct list_head cq_overflow_list;
355351
struct io_hash_table cancel_table;

io_uring/io_uring.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
334334
init_llist_head(&ctx->work_llist);
335335
INIT_LIST_HEAD(&ctx->tctx_list);
336336
ctx->submit_state.free_list.next = NULL;
337-
INIT_WQ_LIST(&ctx->locked_free_list);
338337
INIT_HLIST_HEAD(&ctx->waitid_list);
339338
#ifdef CONFIG_FUTEX
340339
INIT_HLIST_HEAD(&ctx->futex_list);
@@ -988,15 +987,6 @@ static void io_preinit_req(struct io_kiocb *req, struct io_ring_ctx *ctx)
988987
memset(&req->big_cqe, 0, sizeof(req->big_cqe));
989988
}
990989

991-
static void io_flush_cached_locked_reqs(struct io_ring_ctx *ctx,
992-
struct io_submit_state *state)
993-
{
994-
spin_lock(&ctx->completion_lock);
995-
wq_list_splice(&ctx->locked_free_list, &state->free_list);
996-
ctx->locked_free_nr = 0;
997-
spin_unlock(&ctx->completion_lock);
998-
}
999-
1000990
/*
1001991
* A request might get retired back into the request caches even before opcode
1002992
* handlers and io_issue_sqe() are done with it, e.g. inline completion path.
@@ -1010,17 +1000,6 @@ __cold bool __io_alloc_req_refill(struct io_ring_ctx *ctx)
10101000
void *reqs[IO_REQ_ALLOC_BATCH];
10111001
int ret;
10121002

1013-
/*
1014-
* If we have more than a batch's worth of requests in our IRQ side
1015-
* locked cache, grab the lock and move them over to our submission
1016-
* side cache.
1017-
*/
1018-
if (data_race(ctx->locked_free_nr) > IO_COMPL_BATCH) {
1019-
io_flush_cached_locked_reqs(ctx, &ctx->submit_state);
1020-
if (!io_req_cache_empty(ctx))
1021-
return true;
1022-
}
1023-
10241003
ret = kmem_cache_alloc_bulk(req_cachep, gfp, ARRAY_SIZE(reqs), reqs);
10251004

10261005
/*
@@ -2654,7 +2633,6 @@ static void io_req_caches_free(struct io_ring_ctx *ctx)
26542633
int nr = 0;
26552634

26562635
mutex_lock(&ctx->uring_lock);
2657-
io_flush_cached_locked_reqs(ctx, &ctx->submit_state);
26582636

26592637
while (!io_req_cache_empty(ctx)) {
26602638
req = io_extract_req(ctx);

0 commit comments

Comments
 (0)