From: Jens Axboe <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>
Subject: [PATCH 07/15] io_uring: kill io_msg_alloc_async_prep()
Date: Tue, 19 Mar 2024 19:17:35 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
We now ONLY call io_msg_alloc_async() from inside prep handling, which
is always locked. No need for this helper anymore, or the check in
io_msg_alloc_async() on whether the ring is locked or not.
Signed-off-by: Jens Axboe <[email protected]>
---
io_uring/net.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/io_uring/net.c b/io_uring/net.c
index 94767d6c1946..21624b7ead8a 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -129,22 +129,19 @@ static void io_netmsg_recycle(struct io_kiocb *req, unsigned int issue_flags)
}
}
-static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req,
- unsigned int issue_flags)
+static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req)
{
struct io_ring_ctx *ctx = req->ctx;
struct io_cache_entry *entry;
struct io_async_msghdr *hdr;
- if (!(issue_flags & IO_URING_F_UNLOCKED)) {
- entry = io_alloc_cache_get(&ctx->netmsg_cache);
- if (entry) {
- hdr = container_of(entry, struct io_async_msghdr, cache);
- hdr->free_iov = NULL;
- req->flags |= REQ_F_ASYNC_DATA;
- req->async_data = hdr;
- return hdr;
- }
+ entry = io_alloc_cache_get(&ctx->netmsg_cache);
+ if (entry) {
+ hdr = container_of(entry, struct io_async_msghdr, cache);
+ hdr->free_iov = NULL;
+ req->flags |= REQ_F_ASYNC_DATA;
+ req->async_data = hdr;
+ return hdr;
}
if (!io_alloc_async_data(req)) {
@@ -155,12 +152,6 @@ static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req,
return NULL;
}
-static inline struct io_async_msghdr *io_msg_alloc_async_prep(struct io_kiocb *req)
-{
- /* ->prep_async is always called from the submission context */
- return io_msg_alloc_async(req, 0);
-}
-
#ifdef CONFIG_COMPAT
static int io_compat_msg_copy_hdr(struct io_kiocb *req,
struct io_async_msghdr *iomsg,
@@ -334,8 +325,7 @@ static int io_sendmsg_prep_setup(struct io_kiocb *req, int is_msg)
struct io_async_msghdr *kmsg;
int ret;
- /* always locked for prep */
- kmsg = io_msg_alloc_async(req, 0);
+ kmsg = io_msg_alloc_async(req);
if (unlikely(!kmsg))
return -ENOMEM;
@@ -554,8 +544,7 @@ static int io_recvmsg_prep_setup(struct io_kiocb *req)
struct io_async_msghdr *kmsg;
int ret;
- /* always locked for prep */
- kmsg = io_msg_alloc_async(req, 0);
+ kmsg = io_msg_alloc_async(req);
if (unlikely(!kmsg))
return -ENOMEM;
--
2.43.0
next prev parent reply other threads:[~2024-03-20 1:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 1:17 [PATCHSET 0/15] Get rid of ->prep_async() Jens Axboe
2024-03-20 1:17 ` [PATCH 01/15] io_uring/net: switch io_send() and io_send_zc() to using io_async_msghdr Jens Axboe
2024-03-20 1:17 ` [PATCH 02/15] io_uring/net: switch io_recv() " Jens Axboe
2024-03-20 1:17 ` [PATCH 03/15] io_uring/net: unify cleanup handling Jens Axboe
2024-03-20 1:17 ` [PATCH 04/15] io_uring/net: always setup an io_async_msghdr Jens Axboe
2024-03-20 1:17 ` [PATCH 05/15] io_uring/net: get rid of ->prep_async() for receive side Jens Axboe
2024-03-20 1:17 ` [PATCH 06/15] io_uring/net: get rid of ->prep_async() for send side Jens Axboe
2024-03-20 1:17 ` Jens Axboe [this message]
2024-03-20 1:17 ` [PATCH 08/15] io_uring/net: add iovec recycling Jens Axboe
2024-03-20 1:17 ` [PATCH 09/15] io_uring/net: drop 'kmsg' parameter from io_req_msg_cleanup() Jens Axboe
2024-03-20 1:17 ` [PATCH 10/15] io_uring/rw: always setup io_async_rw for read/write requests Jens Axboe
2024-03-20 1:17 ` [PATCH 11/15] io_uring: get rid of struct io_rw_state Jens Axboe
2024-03-20 1:17 ` [PATCH 12/15] io_uring/rw: add iovec recycling Jens Axboe
2024-03-20 1:17 ` [PATCH 13/15] io_uring/net: move connect to always using async data Jens Axboe
2024-03-20 1:17 ` [PATCH 14/15] io_uring/uring_cmd: switch to always allocating " Jens Axboe
2024-03-20 1:17 ` [PATCH 15/15] io_uring: drop ->prep_async() 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 \
[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