diff options
author | David Howells <dhowells@redhat.com> | 2023-06-09 11:02:20 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-06-12 21:13:23 -0700 |
commit | 264ba53fac79b03ff754bce62da5027ee3c57b8f (patch) | |
tree | 1dc6134f3ea5f946387fe602753c713073579109 /net/kcm | |
parent | de17c6857301f1f5b0e71dd064bb816d6628a91d (diff) | |
download | lwn-264ba53fac79b03ff754bce62da5027ee3c57b8f.tar.gz lwn-264ba53fac79b03ff754bce62da5027ee3c57b8f.zip |
kcm: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage
When transmitting data, call down into the transport socket using sendmsg
with MSG_SPLICE_PAGES to indicate that content should be spliced rather
than using sendpage.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Tom Herbert <tom@herbertland.com>
cc: Tom Herbert <tom@quantonium.net>
cc: Jens Axboe <axboe@kernel.dk>
cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/kcm')
-rw-r--r-- | net/kcm/kcmsock.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index 7dee74430b59..3bcac1453f10 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -641,6 +641,10 @@ do_frag_list: for (fragidx = 0; fragidx < skb_shinfo(skb)->nr_frags; fragidx++) { + struct bio_vec bvec; + struct msghdr msg = { + .msg_flags = MSG_DONTWAIT | MSG_SPLICE_PAGES, + }; skb_frag_t *frag; frag_offset = 0; @@ -651,11 +655,13 @@ do_frag: goto out; } - ret = kernel_sendpage(psock->sk->sk_socket, - skb_frag_page(frag), - skb_frag_off(frag) + frag_offset, - skb_frag_size(frag) - frag_offset, - MSG_DONTWAIT); + bvec_set_page(&bvec, + skb_frag_page(frag), + skb_frag_size(frag) - frag_offset, + skb_frag_off(frag) + frag_offset); + iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, + bvec.bv_len); + ret = sock_sendmsg(psock->sk->sk_socket, &msg); if (ret <= 0) { if (ret == -EAGAIN) { /* Save state to try again when there's |