• E
    net: speedup udp receive path · 4b0b72f7
    Eric Dumazet 提交于
    Since commit 95766fff ([UDP]: Add memory accounting.), 
    each received packet needs one extra sock_lock()/sock_release() pair.
    
    This added latency because of possible backlog handling. Then later,
    ticket spinlocks added yet another latency source in case of DDOS.
    
    This patch introduces lock_sock_bh() and unlock_sock_bh()
    synchronization primitives, avoiding one atomic operation and backlog
    processing.
    
    skb_free_datagram_locked() uses them instead of full blown
    lock_sock()/release_sock(). skb is orphaned inside locked section for
    proper socket memory reclaim, and finally freed outside of it.
    
    UDP receive path now take the socket spinlock only once.
    Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    4b0b72f7
sock.h 48.9 KB