]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
tcp: tweak len/truesize ratio for coalesce candidates
authorEric Dumazet <edumazet@google.com>
Wed, 21 Jul 2021 10:15:28 +0000 (03:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 21 Jul 2021 16:05:57 +0000 (09:05 -0700)
commit240bfd134c592791fdceba1ce7fc3f973c33df2d
treed6d407408a8649b6e1dedb92044d307a092549c4
parent54cb43199e14c1181ddcd4a3782f1f7eb56bdab8
tcp: tweak len/truesize ratio for coalesce candidates

tcp_grow_window() is using skb->len/skb->truesize to increase tp->rcv_ssthresh
which has a direct impact on advertized window sizes.

We added TCP coalescing in linux-3.4 & linux-3.5:

Instead of storing skbs with one or two MSS in receive queue (or OFO queue),
we try to append segments together to reduce memory overhead.

High performance network drivers tend to cook skb with 3 parts :

1) sk_buff structure (256 bytes)
2) skb->head contains room to copy headers as needed, and skb_shared_info
3) page fragment(s) containing the ~1514 bytes frame (or more depending on MTU)

Once coalesced into a previous skb, 1) and 2) are freed.

We can therefore tweak the way we compute len/truesize ratio knowing
that skb->truesize is inflated by 1) and 2) soon to be freed.

This is done only for in-order skb, or skb coalesced into OFO queue.

The result is that low rate flows no longer pay the memory price of having
low GRO aggregation factor. Same result for drivers not using GRO.

This is critical to allow a big enough receiver window,
typically tcp_rmem[2] / 2.

We have been using this at Google for about 5 years, it is due time
to make it upstream.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c