small io_uring/net fixes and uapi improvements
cover small io_uring/net fixes and uapi improvements
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(-)
Signature · 1 line
2.37.0
PATCH 1/3 io_uring/net: use right helpers for async recycle
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.
--- io_uring/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/net.c +1 -1
@@ -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 */
Signature · 1 line
2.37.0
PATCH 2/3 io_uring/net: improve zc addr import error handling
In reply to Pavel BegunkovWe 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.
--- io_uring/net.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
io_uring/net.c +8 -8
@@ -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 ;
Signature · 1 line
2.37.0
PATCH 3/3 io_uring/notif: raise limit on notification slots
In reply to Pavel Begunkov1024 notification slots is rather an arbitrary value, raise it up, everything is accounted to memcg.
--- io_uring/notif.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/notif.h +1 -1
@@ -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;
Signature · 1 line
2.37.0
Quoted 8 lines · Pavel Begunkov
Just a random bunch of changes we need in 5.20
Pavel Begunkov (3):
io_uring/net: use right helpers for async recycleio_uring/net: improve zc addr import error handlingio_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: 5993000dc6b31b927403cee65fbc5f9f070fa3e4Best regards,
Signature · 1 line
Jens Axboe