Skip to content

Commit eb18c29

Browse files
committed
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 <[email protected]>
1 parent c3f9109 commit eb18c29

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

io_uring/net.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,10 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
855855
if (!io_check_multishot(req, issue_flags))
856856
return io_setup_async_msg(req, kmsg, issue_flags);
857857

858+
flags = sr->msg_flags;
859+
if (force_nonblock)
860+
flags |= MSG_DONTWAIT;
861+
858862
retry_multishot:
859863
if (io_do_buffer_select(req)) {
860864
void __user *buf;
@@ -875,10 +879,6 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
875879
iov_iter_ubuf(&kmsg->msg.msg_iter, ITER_DEST, buf, len);
876880
}
877881

878-
flags = sr->msg_flags;
879-
if (force_nonblock)
880-
flags |= MSG_DONTWAIT;
881-
882882
kmsg->msg.msg_get_inq = 1;
883883
kmsg->msg.msg_inq = -1;
884884
if (req->flags & REQ_F_APOLL_MULTISHOT) {
@@ -964,6 +964,10 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
964964
msg.msg_iocb = NULL;
965965
msg.msg_ubuf = NULL;
966966

967+
flags = sr->msg_flags;
968+
if (force_nonblock)
969+
flags |= MSG_DONTWAIT;
970+
967971
retry_multishot:
968972
if (io_do_buffer_select(req)) {
969973
void __user *buf;
@@ -982,9 +986,6 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
982986
msg.msg_inq = -1;
983987
msg.msg_flags = 0;
984988

985-
flags = sr->msg_flags;
986-
if (force_nonblock)
987-
flags |= MSG_DONTWAIT;
988989
if (flags & MSG_WAITALL)
989990
min_ret = iov_iter_count(&msg.msg_iter);
990991

0 commit comments

Comments
 (0)