diff mbox series

[net-next,1/2] net/tcp: don't peek at tail for io_uring zc

Message ID d49262a8a39c995cd55f89d1f6fd39cd4346f528.1684166247.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series minor tcp io_uring zc optimisations | expand

Commit Message

Pavel Begunkov May 15, 2023, 4:06 p.m. UTC
Move tcp_write_queue_tail() to SOCK_ZEROCOPY specific flag as zerocopy
setup for msghdr->ubuf_info doesn't need to peek into the last request.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 net/ipv4/tcp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Ahern May 15, 2023, 5:27 p.m. UTC | #1
On 5/15/23 10:06 AM, Pavel Begunkov wrote:
> Move tcp_write_queue_tail() to SOCK_ZEROCOPY specific flag as zerocopy
> setup for msghdr->ubuf_info doesn't need to peek into the last request.
> 
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
>  net/ipv4/tcp.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
Eric Dumazet May 15, 2023, 6:11 p.m. UTC | #2
On Mon, May 15, 2023 at 7:27 PM David Ahern <dsahern@kernel.org> wrote:
>
> On 5/15/23 10:06 AM, Pavel Begunkov wrote:
> > Move tcp_write_queue_tail() to SOCK_ZEROCOPY specific flag as zerocopy
> > setup for msghdr->ubuf_info doesn't need to peek into the last request.
> >
> > Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> > ---
> >  net/ipv4/tcp.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
>
> Reviewed-by: David Ahern <dsahern@kernel.org>


Reviewed-by: Eric Dumazet <edumazet@google.com>
diff mbox series

Patch

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4d6392c16b7a..40f591f7fce1 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1229,13 +1229,12 @@  int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
 	flags = msg->msg_flags;
 
 	if ((flags & MSG_ZEROCOPY) && size) {
-		skb = tcp_write_queue_tail(sk);
-
 		if (msg->msg_ubuf) {
 			uarg = msg->msg_ubuf;
 			net_zcopy_get(uarg);
 			zc = sk->sk_route_caps & NETIF_F_SG;
 		} else if (sock_flag(sk, SOCK_ZEROCOPY)) {
+			skb = tcp_write_queue_tail(sk);
 			uarg = msg_zerocopy_realloc(sk, size, skb_zcopy(skb));
 			if (!uarg) {
 				err = -ENOBUFS;