public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 3/4] io_uring: reuse io_alloc_req()
Date: Sun, 16 Oct 2022 21:30:50 +0100	[thread overview]
Message-ID: <6005fc88274864a49fc3096c22d8bdd605cf8576.1665891182.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

Don't duplicate io_alloc_req() in io_req_caches_free() but reuse the
helper.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/io_uring.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 6e50f548de1a..62be51fbf39c 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2560,18 +2560,14 @@ static int io_eventfd_unregister(struct io_ring_ctx *ctx)
 
 static void io_req_caches_free(struct io_ring_ctx *ctx)
 {
-	struct io_submit_state *state = &ctx->submit_state;
 	int nr = 0;
 
 	mutex_lock(&ctx->uring_lock);
-	io_flush_cached_locked_reqs(ctx, state);
+	io_flush_cached_locked_reqs(ctx, &ctx->submit_state);
 
 	while (!io_req_cache_empty(ctx)) {
-		struct io_wq_work_node *node;
-		struct io_kiocb *req;
+		struct io_kiocb *req = io_alloc_req(ctx);
 
-		node = wq_stack_extract(&state->free_list);
-		req = container_of(node, struct io_kiocb, comp_list);
 		kmem_cache_free(req_cachep, req);
 		nr++;
 	}
-- 
2.38.0


  parent reply	other threads:[~2022-10-16 20:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 20:30 [PATCH 0/4] random io_uring cleanups Pavel Begunkov
2022-10-16 20:30 ` [PATCH 1/4] io_uring: remove FFS_SCM Pavel Begunkov
2022-10-16 20:30 ` [PATCH 2/4] io_uring: kill hot path fixed file bitmap debug checks Pavel Begunkov
2022-10-16 20:30 ` Pavel Begunkov [this message]
2022-10-16 20:30 ` [PATCH 4/4] io_uring: don't iopoll from io_ring_ctx_wait_and_kill() Pavel Begunkov
2022-10-16 23:08 ` [PATCH 0/4] random io_uring cleanups Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6005fc88274864a49fc3096c22d8bdd605cf8576.1665891182.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox