Skip to content

Commit

Permalink
tcp: tcp_sendmsg() page recycling
Browse files Browse the repository at this point in the history
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: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Dec 4, 2011
1 parent 117632e commit 761965e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,12 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int merge = 0;
int i = skb_shinfo(skb)->nr_frags;
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) &&
off != PAGE_SIZE) {
Expand Down

0 comments on commit 761965e

Please sign in to comment.