summaryrefslogtreecommitdiffstats
path: root/io_uring
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-02-25 20:59:05 +0100
committerJens Axboe <axboe@kernel.dk>2024-03-01 14:28:19 +0100
commiteb18c29dd2a3d49cf220ee34411ff0fe60b36bf2 (patch)
treef3d9cecbc29250c0ea315f744bf463a67bd9be09 /io_uring
parentio_uring/kbuf: flag request if buffer pool is empty after buffer pick (diff)
downloadlinux-eb18c29dd2a3d49cf220ee34411ff0fe60b36bf2.tar.xz
linux-eb18c29dd2a3d49cf220ee34411ff0fe60b36bf2.zip
io_uring/net: move recv/recvmsg flags out of retry loop
The flags don't change, just intialize them once rather than every loop for multishot. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/net.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index 83fba2882720..8b9a9f5bbd14 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -855,6 +855,10 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
if (!io_check_multishot(req, issue_flags))
return io_setup_async_msg(req, kmsg, issue_flags);
+ flags = sr->msg_flags;
+ if (force_nonblock)
+ flags |= MSG_DONTWAIT;
+
retry_multishot:
if (io_do_buffer_select(req)) {
void __user *buf;
@@ -875,10 +879,6 @@ retry_multishot:
iov_iter_ubuf(&kmsg->msg.msg_iter, ITER_DEST, buf, len);
}
- flags = sr->msg_flags;
- if (force_nonblock)
- flags |= MSG_DONTWAIT;
-
kmsg->msg.msg_get_inq = 1;
kmsg->msg.msg_inq = -1;
if (req->flags & REQ_F_APOLL_MULTISHOT) {
@@ -964,6 +964,10 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
msg.msg_iocb = NULL;
msg.msg_ubuf = NULL;
+ flags = sr->msg_flags;
+ if (force_nonblock)
+ flags |= MSG_DONTWAIT;
+
retry_multishot:
if (io_do_buffer_select(req)) {
void __user *buf;
@@ -982,9 +986,6 @@ retry_multishot:
msg.msg_inq = -1;
msg.msg_flags = 0;
- flags = sr->msg_flags;
- if (force_nonblock)
- flags |= MSG_DONTWAIT;
if (flags & MSG_WAITALL)
min_ret = iov_iter_count(&msg.msg_iter);