[PATCH net-next] tcp: use page_ref_inc() in tcp_sendmsg()

Subsystems: networking [general], networking [tcp], the rest

STALE3491d

2 messages, 2 authors, 2017-02-17 · open the first message on its own page

[PATCH net-next] tcp: use page_ref_inc() in tcp_sendmsg()

From: Eric Dumazet <hidden>
Date: 2017-02-17 17:11:44

From: Eric Dumazet <edumazet@google.com>

sk_page_frag_refill() allocates either a compound page or an order-0
page. We can use page_ref_inc() which is slightly faster than get_page()

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index d44a6989e76d69aa44e2a26d37b4204376c94966..da385ae997a3d61f0217a2e585088a82e6d50cd3 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1288,7 +1288,7 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 			} else {
 				skb_fill_page_desc(skb, i, pfrag->page,
 						   pfrag->offset, copy);
-				get_page(pfrag->page);
+				page_ref_inc(pfrag->page);
 			}
 			pfrag->offset += copy;
 		}

Re: [PATCH net-next] tcp: use page_ref_inc() in tcp_sendmsg()

From: David Miller <davem@davemloft.net>
Date: 2017-02-17 20:37:26

From: Eric Dumazet <redacted>
Date: Fri, 17 Feb 2017 09:11:42 -0800
From: Eric Dumazet <edumazet@google.com>

sk_page_frag_refill() allocates either a compound page or an order-0
page. We can use page_ref_inc() which is slightly faster than get_page()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help