]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: avoid frag allocation for small frames
authorEric Dumazet <eric.dumazet@gmail.com>
Mon, 28 Nov 2011 22:41:47 +0000 (22:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Nov 2011 18:17:03 +0000 (13:17 -0500)
commit042f54e9a2ad159a85d20e0e89a47eabc8398701
tree33f1313283e85a642f4126029e47e4ec1f606282
parentaf544985d45e84a554a3d2604fa56e7f6ae16f13
tcp: avoid frag allocation for small frames

tcp_sendmsg() uses select_size() helper to choose skb head size when a
new skb must be allocated.

If GSO is enabled for the socket, current strategy is to force all
payload data to be outside of headroom, in PAGE fragments.

This strategy is not welcome for small packets, wasting memory.

Experiments show that best results are obtained when using 2048 bytes
for skb head (This includes the skb overhead and various headers)

This patch provides better len/truesize ratios for packets sent to
loopback device, and reduce memory needs for in-flight loopback packets,
particularly on arches with big pages.

If a sender sends many 1-byte packets to an unresponsive application,
receiver rmem_alloc will grow faster and will stop queuing these packets
sooner, or will collapse its receive queue to free excess memory.

netperf -t TCP_RR results are improved by ~4 %, and many workloads are
improved as well (tbench, mysql...)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c