Skip to content
  • Eric Dumazet's avatar
    netns: reorder fields in struct net · 8e602ce2
    Eric Dumazet authored
    
    
    In a network bench, I noticed an unfortunate false sharing between
    'loopback_dev' and 'count' fields in "struct net".
    
    'count' is written each time a socket is created or destroyed, while
    loopback_dev might be often read in routing code.
    
    Move loopback_dev in a read mostly section of "struct net"
    
    Note: struct netns_xfrm is cache line aligned on SMP.
    (It contains a "struct dst_ops")
    Move it at the end to avoid holes, and reduce sizeof(struct net) by 128
    bytes on ia32.
    
    Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8e602ce2