From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH 8/8] io_uring/rw: simplify io_rw_recycle()
Date: Tue, 28 Jan 2025 20:56:16 +0000 [thread overview]
Message-ID: <14f83b112eb40078bea18e15d77a4f99fc981a44.1738087204.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
Instead of freeing iovecs in case of IO_URING_F_UNLOCKED in
io_rw_recycle(), leave it be and rely on the core io_uring code to
call io_readv_writev_cleanup() later. This way the iovec will get
recycled and we can clean up io_rw_recycle() and kill
io_rw_iovec_free().
Signed-off-by: Pavel Begunkov <[email protected]>
---
io_uring/rw.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/io_uring/rw.c b/io_uring/rw.c
index c496f195aae2b..7aa1e4c9f64a3 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -146,23 +146,13 @@ static inline int io_import_iovec(int rw, struct io_kiocb *req,
return 0;
}
-static void io_rw_iovec_free(struct io_async_rw *rw)
-{
- if (rw->free_iovec) {
- kfree(rw->free_iovec);
- rw->free_iov_nr = 0;
- rw->free_iovec = NULL;
- }
-}
-
static void io_rw_recycle(struct io_kiocb *req, unsigned int issue_flags)
{
struct io_async_rw *rw = req->async_data;
- if (unlikely(issue_flags & IO_URING_F_UNLOCKED)) {
- io_rw_iovec_free(rw);
+ if (unlikely(issue_flags & IO_URING_F_UNLOCKED))
return;
- }
+
io_alloc_cache_kasan(&rw->free_iovec, &rw->free_iov_nr);
if (io_alloc_cache_put(&req->ctx->rw_cache, rw)) {
req->async_data = NULL;
@@ -1310,6 +1300,6 @@ void io_rw_cache_free(const void *entry)
struct io_async_rw *rw = (struct io_async_rw *) entry;
if (rw->free_iovec)
- io_rw_iovec_free(rw);
+ kfree(rw->free_iovec);
kfree(rw);
}
--
2.47.1
next prev parent reply other threads:[~2025-01-28 20:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-28 20:56 [PATCH 0/8] alloc cache and iovec assorted cleanups Pavel Begunkov
2025-01-28 20:56 ` [PATCH 1/8] io_uring: include all deps for alloc_cache.h Pavel Begunkov
2025-01-28 20:56 ` [PATCH 2/8] io_uring: dont ifdef io_alloc_cache_kasan() Pavel Begunkov
2025-01-28 20:56 ` [PATCH 3/8] io_uring: add alloc_cache.c Pavel Begunkov
2025-01-28 20:56 ` [PATCH 4/8] io_uring/net: make io_net_vec_assign() return void Pavel Begunkov
2025-01-28 20:56 ` [PATCH 5/8] io_uring/net: clean io_msg_copy_hdr() Pavel Begunkov
2025-01-28 20:56 ` [PATCH 6/8] io_uring/net: extract io_send_select_buffer() Pavel Begunkov
2025-01-28 20:56 ` [PATCH 7/8] io_uring: remove !KASAN guards from cache free Pavel Begunkov
2025-01-28 20:56 ` Pavel Begunkov [this message]
2025-01-28 21:59 ` [PATCH 0/8] alloc cache and iovec assorted cleanups Gabriel Krisman Bertazi
2025-01-28 22:42 ` 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=14f83b112eb40078bea18e15d77a4f99fc981a44.1738087204.git.asml.silence@gmail.com \
[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