* [PATCH] io_uring/net: account memory for zc sendmsg
@ 2025-03-27 15:02 Pavel Begunkov
2025-03-28 13:46 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-03-27 15:02 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence
Account pinned pages for IORING_OP_SENDMSG_ZC, just as we for
IORING_OP_SEND_ZC and net/ does for MSG_ZEROCOPY.
Fixes: 493108d95f146 ("io_uring/net: zerocopy sendmsg")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/net.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/io_uring/net.c b/io_uring/net.c
index 616e953ef0ae..a1d32555fe6a 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1304,6 +1304,7 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
struct io_ring_ctx *ctx = req->ctx;
struct io_kiocb *notif;
+ int ret;
zc->done_io = 0;
zc->retry = false;
@@ -1356,7 +1357,16 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
req->flags |= REQ_F_IMPORT_BUFFER;
return io_send_setup(req, sqe);
}
- return io_sendmsg_zc_setup(req, sqe);
+ ret = io_sendmsg_zc_setup(req, sqe);
+ if (unlikely(ret))
+ return ret;
+
+ if (!(zc->flags & IORING_RECVSEND_FIXED_BUF)) {
+ struct io_async_msghdr *iomsg = req->async_data;
+
+ return io_notif_account_mem(zc->notif, iomsg->msg.msg_iter.count);
+ }
+ return 0;
}
static int io_sg_from_iter_iovec(struct sk_buff *skb,
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] io_uring/net: account memory for zc sendmsg
2025-03-27 15:02 [PATCH] io_uring/net: account memory for zc sendmsg Pavel Begunkov
@ 2025-03-28 13:46 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-03-28 13:46 UTC (permalink / raw)
To: io-uring, Pavel Begunkov
On Thu, 27 Mar 2025 15:02:20 +0000, Pavel Begunkov wrote:
> Account pinned pages for IORING_OP_SENDMSG_ZC, just as we for
> IORING_OP_SEND_ZC and net/ does for MSG_ZEROCOPY.
>
>
Applied, thanks!
[1/1] io_uring/net: account memory for zc sendmsg
commit: f20cf4ffec98663bfa0fa234a82dfd8fd92de9e0
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-28 13:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27 15:02 [PATCH] io_uring/net: account memory for zc sendmsg Pavel Begunkov
2025-03-28 13:46 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox