• Kuniyuki Iwashima's avatar
    tcp: Don't allocate tcp_death_row outside of struct netns_ipv4. · e9bd0cca
    Kuniyuki Iwashima authored
    We will soon introduce an optional per-netns ehash and access hash
    tables via net->ipv4.tcp_death_row->hashinfo instead of &tcp_hashinfo
    in most places.
    
    It could harm the fast path because dereferences of two fields in net
    and tcp_death_row might incur two extra cache line misses.  To save one
    dereference, let's place tcp_death_row back in netns_ipv4 and fetch
    hashinfo via net->ipv4.tcp_death_row"."hashinfo.
    
    Note tcp_death_row was initially placed in netns_ipv4, and commit
    fbb82952 ("tcp: allocate tcp_death_row outside of struct netns_ipv4")
    changed it to a pointer so that we can fire TIME_WAIT timers after freeing
    net.  However, we don't do so after commit 04c494e6 ("Revert "tcp/dccp:
    get rid of inet_twsk_purge()""), so we need not define tcp_death_row as a
    pointer.
    
    Also, we move refcount_dec_and_test(&tw_refcount) from tcp_sk_exit() to
    tcp_sk_exit_batch() as a debug check.
    Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
    Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    e9bd0cca
tcp_minisocks.c 26.6 KB