• Jesper Dangaard Brouer's avatar
    net: use lib/percpu_counter API for fragmentation mem accounting · 6d7b857d
    Jesper Dangaard Brouer authored
    Replace the per network namespace shared atomic "mem" accounting
    variable, in the fragmentation code, with a lib/percpu_counter.
    
    Getting percpu_counter to scale to the fragmentation code usage
    requires some tweaks.
    
    At first view, percpu_counter looks superfast, but it does not
    scale on multi-CPU/NUMA machines, because the default batch size
    is too small, for frag code usage.  Thus, I have adjusted the
    batch size by using __percpu_counter_add() directly, instead of
    percpu_counter_sub() and percpu_counter_add().
    
    The batch size is increased to 130.000, based on the largest 64K
    fragment memory usage.  This does introduce some imprecise
    memory accounting, but its does not need to be strict for this
    use-case.
    
    It is also essential, that the percpu_counter, does not
    share cacheline with other writers, to make this scale.
    Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6d7b857d
inet_frag.h 3.25 KB