]> git.baikalelectronics.ru Git - kernel.git/commit
net: use lib/percpu_counter API for fragmentation mem accounting
authorJesper Dangaard Brouer <brouer@redhat.com>
Mon, 28 Jan 2013 23:45:33 +0000 (23:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Jan 2013 18:36:24 +0000 (13:36 -0500)
commitfbb97c828cbedc0dc7cea2db7f86e6ebd09eada9
treedf7813da4f92cad8413f71c325969b89416d8a24
parenta0c7bd6b9a18a00acd044950df9b76d8568f4560
net: use lib/percpu_counter API for fragmentation mem accounting

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: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/inet_frag.h
net/ipv4/inet_fragment.c