[PATCH 5/9] io_uring/net: avoid redundant -ENOBUFS on recv multishot retry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that we know if the buffer list is empty upfront, there's no point
doing a retry for that case. This can help avoid a redundant -ENOBUFS
which would terminate the multishot receive, requiring the app to
re-arm it.

Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
 io_uring/net.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/io_uring/net.c b/io_uring/net.c
index 679eefcd11c5..aaab4f121b7f 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -698,6 +698,11 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
 		int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE;
 
 		io_recv_prep_retry(req);
+
+		/* buffer list now empty, no point trying again */
+		if (req->flags & REQ_F_BL_EMPTY)
+			goto enobufs;
+
 		/* Known not-empty or unknown state, retry */
 		if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq == -1) {
 			if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY)
@@ -706,6 +711,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
 			sr->nr_multishot_loops = 0;
 			mshot_retry_ret = IOU_REQUEUE;
 		}
+enobufs:
 		if (issue_flags & IO_URING_F_MULTISHOT)
 			*ret = mshot_retry_ret;
 		else
-- 
2.43.0





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux