]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: Fix truesize accounting in tcp_try_coalesce
authorAlexander Duyck <alexander.h.duyck@intel.com>
Wed, 2 May 2012 21:18:59 +0000 (21:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 May 2012 08:21:33 +0000 (04:21 -0400)
commitf80286cf43262af8213d01dd7811a2349c3eb03c
treeb38ef55d8b2cd88a1e02ee9d990c89071edf136c
parent97743900fd7d9662f015d7c54e28dac33e56cf54
tcp: Fix truesize accounting in tcp_try_coalesce

This patch addresses several issues in the way we were tracking the
truesize in tcp_try_coalesce.

First it was using ksize which prevents us from having a 0 sized head frag
and getting a usable result.  To resolve that this patch uses the end
pointer which is set based off either ksize, or the frag_size supplied in
build_skb.  This allows us to compute the original truesize of the entire
buffer and remove that value leaving us with just what was added as pages.

The second issue was the use of skb->len if there is a mergeable head frag.
We should only need to remove the size of an data aligned sk_buff from our
current skb->truesize to compute the delta for a buffer with a reused head.
By using skb->len the value of truesize was being artificially reduced
which means that head frags could use more memory than buffers using
standard allocations.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c