Commit 761965ea authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: tcp_sendmsg() page recycling

If our TCP_PAGE(sk) is not shared (page_count() == 1), we can set page
offset to 0.

This permits better filling of the pages on small to medium tcp writes.

"tbench 16" results on my dev server (2x4x2 machine) :

Before : 3072 MB/s
After  : 3146 MB/s  (2.4 % gain)
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 117632e6
...@@ -1009,7 +1009,12 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -1009,7 +1009,12 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int merge = 0; int merge = 0;
int i = skb_shinfo(skb)->nr_frags; int i = skb_shinfo(skb)->nr_frags;
struct page *page = TCP_PAGE(sk); struct page *page = TCP_PAGE(sk);
int off = TCP_OFF(sk); int off;
if (page && page_count(page) == 1)
TCP_OFF(sk) = 0;
off = TCP_OFF(sk);
if (skb_can_coalesce(skb, i, page, off) && if (skb_can_coalesce(skb, i, page, off) &&
off != PAGE_SIZE) { off != PAGE_SIZE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment