netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: tcp_sendmsg() page recycling
@ 2011-12-04 17:05 Eric Dumazet
  2011-12-04 17:20 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Eric Dumazet @ 2011-12-04 17:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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>
---
 net/ipv4/tcp.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 45156be..a09fe25 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1009,7 +1009,12 @@ new_segment:
 				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) {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-05 23:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-04 17:05 [PATCH net-next] tcp: tcp_sendmsg() page recycling Eric Dumazet
2011-12-04 17:20 ` Joe Perches
2011-12-04 18:27   ` Nicolas de Pesloüan
2011-12-04 18:54     ` Joe Perches
2011-12-05 11:07   ` [PATCH net-next] tcp: remove TCP_OFF and TCP_PAGE macros Eric Dumazet
2011-12-05 23:47     ` David Miller
2011-12-04 17:36 ` [PATCH net-next] tcp: tcp_sendmsg() page recycling Eric Dumazet
2011-12-04 18:14   ` David Miller
2011-12-04 18:21 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).