public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements
@ 2022-08-15 12:41 Pavel Begunkov
  2022-08-15 12:42 ` [PATCH for-5.20 1/3] io_uring/net: use right helpers for async recycle Pavel Begunkov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Pavel Begunkov @ 2022-08-15 12:41 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

Just a random bunch of changes we need in 5.20

Pavel Begunkov (3):
  io_uring/net: use right helpers for async recycle
  io_uring/net: improve zc addr import error handling
  io_uring/notif: raise limit on notification slots

 io_uring/net.c   | 18 +++++++++---------
 io_uring/notif.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

-- 
2.37.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH for-5.20 1/3] io_uring/net: use right helpers for async recycle
  2022-08-15 12:41 [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Pavel Begunkov
@ 2022-08-15 12:42 ` Pavel Begunkov
  2022-08-15 12:42 ` [PATCH for-5.20 2/3] io_uring/net: improve zc addr import error handling Pavel Begunkov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2022-08-15 12:42 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

We have a helper that checks for whether a request contains anything in
->async_data or not, namely req_has_async_data(). It's better to use it
as it might have some extra considerations.

Fixes: 43e0bbbd0b0e3 ("io_uring: add netmsg cache")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 6d71748e2c5a..2129562bfd9f 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -116,7 +116,7 @@ static void io_netmsg_recycle(struct io_kiocb *req, unsigned int issue_flags)
 {
 	struct io_async_msghdr *hdr = req->async_data;
 
-	if (!hdr || issue_flags & IO_URING_F_UNLOCKED)
+	if (!req_has_async_data(req) || issue_flags & IO_URING_F_UNLOCKED)
 		return;
 
 	/* Let normal cleanup path reap it if we fail adding to the cache */
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-5.20 2/3] io_uring/net: improve zc addr import error handling
  2022-08-15 12:41 [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Pavel Begunkov
  2022-08-15 12:42 ` [PATCH for-5.20 1/3] io_uring/net: use right helpers for async recycle Pavel Begunkov
@ 2022-08-15 12:42 ` Pavel Begunkov
  2022-08-15 12:42 ` [PATCH for-5.20 3/3] io_uring/notif: raise limit on notification slots Pavel Begunkov
  2022-08-16  3:34 ` [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Jens Axboe
  3 siblings, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2022-08-15 12:42 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

We may account memory to a memcg of a request that didn't even got to
the network layer. It's not a bug as it'll be routinely cleaned up on
flush, but it might be confusing for the userspace.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/net.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 2129562bfd9f..f7cbd716817f 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -977,6 +977,14 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
 	msg.msg_controllen = 0;
 	msg.msg_namelen = 0;
 
+	if (zc->addr) {
+		ret = move_addr_to_kernel(zc->addr, zc->addr_len, &address);
+		if (unlikely(ret < 0))
+			return ret;
+		msg.msg_name = (struct sockaddr *)&address;
+		msg.msg_namelen = zc->addr_len;
+	}
+
 	if (zc->flags & IORING_RECVSEND_FIXED_BUF) {
 		ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
 					(u64)(uintptr_t)zc->buf, zc->len);
@@ -992,14 +1000,6 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
 			return ret;
 	}
 
-	if (zc->addr) {
-		ret = move_addr_to_kernel(zc->addr, zc->addr_len, &address);
-		if (unlikely(ret < 0))
-			return ret;
-		msg.msg_name = (struct sockaddr *)&address;
-		msg.msg_namelen = zc->addr_len;
-	}
-
 	msg_flags = zc->msg_flags | MSG_ZEROCOPY;
 	if (issue_flags & IO_URING_F_NONBLOCK)
 		msg_flags |= MSG_DONTWAIT;
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-5.20 3/3] io_uring/notif: raise limit on notification slots
  2022-08-15 12:41 [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Pavel Begunkov
  2022-08-15 12:42 ` [PATCH for-5.20 1/3] io_uring/net: use right helpers for async recycle Pavel Begunkov
  2022-08-15 12:42 ` [PATCH for-5.20 2/3] io_uring/net: improve zc addr import error handling Pavel Begunkov
@ 2022-08-15 12:42 ` Pavel Begunkov
  2022-08-16  3:34 ` [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Jens Axboe
  3 siblings, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2022-08-15 12:42 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

1024 notification slots is rather an arbitrary value, raise it up,
everything is accounted to memcg.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/notif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/notif.h b/io_uring/notif.h
index 65f0b42f2555..80f6445e0c2b 100644
--- a/io_uring/notif.h
+++ b/io_uring/notif.h
@@ -8,7 +8,7 @@
 #include "rsrc.h"
 
 #define IO_NOTIF_SPLICE_BATCH	32
-#define IORING_MAX_NOTIF_SLOTS (1U << 10)
+#define IORING_MAX_NOTIF_SLOTS	(1U << 15)
 
 struct io_notif_data {
 	struct file		*file;
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements
  2022-08-15 12:41 [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Pavel Begunkov
                   ` (2 preceding siblings ...)
  2022-08-15 12:42 ` [PATCH for-5.20 3/3] io_uring/notif: raise limit on notification slots Pavel Begunkov
@ 2022-08-16  3:34 ` Jens Axboe
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-08-16  3:34 UTC (permalink / raw)
  To: asml.silence, io-uring

On Mon, 15 Aug 2022 13:41:59 +0100, Pavel Begunkov wrote:
> Just a random bunch of changes we need in 5.20
> 
> Pavel Begunkov (3):
>   io_uring/net: use right helpers for async recycle
>   io_uring/net: improve zc addr import error handling
>   io_uring/notif: raise limit on notification slots
> 
> [...]

Applied, thanks!

[1/3] io_uring/net: use right helpers for async recycle
      commit: 063604265f967e90901996a1b173fe6df582d350
[2/3] io_uring/net: improve zc addr import error handling
      commit: 86dc8f23bb1b68262ca5db890ec7177b2d074640
[3/3] io_uring/notif: raise limit on notification slots
      commit: 5993000dc6b31b927403cee65fbc5f9f070fa3e4

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-16  7:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15 12:41 [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Pavel Begunkov
2022-08-15 12:42 ` [PATCH for-5.20 1/3] io_uring/net: use right helpers for async recycle Pavel Begunkov
2022-08-15 12:42 ` [PATCH for-5.20 2/3] io_uring/net: improve zc addr import error handling Pavel Begunkov
2022-08-15 12:42 ` [PATCH for-5.20 3/3] io_uring/notif: raise limit on notification slots Pavel Begunkov
2022-08-16  3:34 ` [PATCH for-5.20 0/3] small io_uring/net fixes and uapi improvements Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox