• Eric Dumazet's avatar
    net: add SOCK_RCU_FREE socket flag · a4298e45
    Eric Dumazet authored
    We want a generic way to insert an RCU grace period before socket
    freeing for cases where RCU_SLAB_DESTROY_BY_RCU is adding too
    much overhead.
    SLAB_DESTROY_BY_RCU strict rules force us to take a reference
    on the socket sk_refcnt, and it is a performance problem for UDP
    encapsulation, or TCP synflood behavior, as many CPUs might
    attempt the atomic operations on a shared sk_refcnt
    UDP sockets and TCP listeners can set SOCK_RCU_FREE so that their
    lookup can use traditional RCU rules, without refcount changes.
    They can set the flag only once hashed and visible by other cpus.
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Cc: Tom Herbert <tom@herbertland.com>
    Tested-by: default avatarTom Herbert <tom@herbertland.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>