• Eric Dumazet's avatar
    tcp: add one skb cache for tx · 472c2e07
    Eric Dumazet authored
    On hosts with a lot of cores, RPC workloads suffer from heavy contention on slab spinlocks.
    
        20.69%  [kernel]       [k] queued_spin_lock_slowpath
         5.64%  [kernel]       [k] _raw_spin_lock
         3.83%  [kernel]       [k] syscall_return_via_sysret
         3.48%  [kernel]       [k] __entry_text_start
         1.76%  [kernel]       [k] __netif_receive_skb_core
         1.64%  [kernel]       [k] __fget
    
    For each sendmsg(), we allocate one skb, and free it at the time ACK packet comes.
    
    In many cases, ACK packets are handled by another cpus, and this unfortunately
    incurs heavy costs for slab layer.
    
    This patch uses an extra pointer in socket structure, so that we try to reuse
    the same skb and avoid these expensive costs.
    
    We cache at most one skb per socket so this should be safe as far as
    memory pressure is concerned.
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
    Acked-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    472c2e07
tcp.c 103 KB