From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 5/6] io_uring: conditional ->async_data allocation
Date: Wed, 24 Aug 2022 13:07:42 +0100 [thread overview]
Message-ID: <9dc62be9e88dd0ed63c48365340e8922d2498293.1661342812.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
There are opcodes that need ->async_data only in some cases and
allocation it unconditionally may hurt performance. Add an option to
opdef to make move the allocation part from the core io_uring to opcode
specific code.
Note, we can't just set opdef->async_size to zero because there are
other helpers that rely on it, e.g. io_alloc_async_data().
Signed-off-by: Pavel Begunkov <[email protected]>
---
io_uring/io_uring.c | 7 ++++---
io_uring/opdef.h | 2 ++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index ebfdb2212ec2..77616279000b 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1450,9 +1450,10 @@ int io_req_prep_async(struct io_kiocb *req)
return 0;
if (WARN_ON_ONCE(req_has_async_data(req)))
return -EFAULT;
- if (io_alloc_async_data(req))
- return -EAGAIN;
-
+ if (!io_op_defs[req->opcode].manual_alloc) {
+ if (io_alloc_async_data(req))
+ return -EAGAIN;
+ }
return def->prep_async(req);
}
diff --git a/io_uring/opdef.h b/io_uring/opdef.h
index ece8ed4f96c4..763c6e54e2ee 100644
--- a/io_uring/opdef.h
+++ b/io_uring/opdef.h
@@ -25,6 +25,8 @@ struct io_op_def {
unsigned ioprio : 1;
/* supports iopoll */
unsigned iopoll : 1;
+ /* opcode specific path will handle ->async_data allocation if needed */
+ unsigned manual_alloc : 1;
/* size of async data needed, if any */
unsigned short async_size;
--
2.37.2
next prev parent reply other threads:[~2022-08-24 12:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 12:07 [PATCH 0/6] bunch of zerocopy send changes Pavel Begunkov
2022-08-24 12:07 ` [PATCH 1/6] io_uring/net: fix must_hold annotation Pavel Begunkov
2022-08-24 12:07 ` [PATCH 2/6] io_uring/net: fix zc send link failing Pavel Begunkov
2022-08-24 12:07 ` [PATCH 3/6] io_uring/net: fix indention Pavel Begunkov
2022-08-24 12:07 ` [PATCH 4/6] io_uring/notif: order notif vs send CQEs Pavel Begunkov
2022-08-24 12:07 ` Pavel Begunkov [this message]
2022-08-24 12:07 ` [PATCH 6/6] io_uring/net: save address for sendzc async execution Pavel Begunkov
2022-08-24 14:57 ` [PATCH 0/6] bunch of zerocopy send changes 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=9dc62be9e88dd0ed63c48365340e8922d2498293.1661342812.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