On Tue, Feb 6, 2018 at 8:27 AM, Tal Gilboa <ta...@mellanox.com> wrote: > On 2/6/2018 5:52 PM, Eric Dumazet wrote: >> >> On Tue, 2018-02-06 at 15:22 +0000, David Laight wrote: >>> >>> From: Eric Dumazet >>>> >>>> Sent: 06 February 2018 14:20 >>> >>> >>> ... >>>> >>>> Please give exact details. >>>> Sending 64, 128, 256 or 512 bytes at a time on TCP_STREAM makes little >>>> sense. >>>> We are not optimizing stack for pathological cases, sorry. >>> >>> >>> There are plenty of workloads which are not bulk data and where multiple >>> small buffers get sent at unknown intervals (which may be back to back). >>> Such connections have to have Nagle disabled because the Nagle delays >>> are 'horrid'. >>> Clearly lost packets can cause delays, but they are rare on local >>> networks. >> >> >> Auto corking makes sure aggregation happens, even for when Nagle is in >> the picture. > > >> >> netperf -- -m 256 will still cook 64KB TSO packets > > > This is what we would have liked to see, but auto corking isn't forcing 64KB > TSO packets. Under certain conditions, specifically when TX queue is empty, > it would send the SKB to transmit even if it isn't full:
Yes. Auto corking does not predict the future, nor arm a high resolution timer when application does a send(small_size) This packet is sent immaediately, as instructed by application and TCP normal behavior. But second or third packet would detect the condition. Unless a driver does skb_orphan() too early, breaking back pressure. > static bool tcp_should_autocork(struct sock *sk, struct sk_buff *skb, > int size_goal) > { > return skb->len < size_goal && > sock_net(sk)->ipv4.sysctl_tcp_autocorking && > skb != tcp_write_queue_head(sk) && > refcount_read(&sk->sk_wmem_alloc) > skb->truesize; > } > When skb == tcp_write_queue_head(sk) corking is done. This is part of the > optimization for mlx5 driver I've mentioned. If we can better utilize auto > corking we shouldn't have an issue. Or not issue expensive system calls for small payloads. stdio was invented a while back :) Meltdown/Spectre mitigation put high price to system calls nowadays.