• Florian Westphal's avatar
    xfrm: add xdst pcpu cache · ec30d78c
    Florian Westphal authored
    retain last used xfrm_dst in a pcpu cache.
    On next request, reuse this dst if the policies are the same.
    
    The cache will not help with strict RR workloads as there is no hit.
    
    The cache packet-path part is reasonably small, the notifier part is
    needed so we do not add long hangs when a device is dismantled but some
    pcpu xdst still holds a reference, there are also calls to the flush
    operation when userspace deletes SAs so modules can be removed
    (there is no hit.
    
    We need to run the dst_release on the correct cpu to avoid races with
    packet path.  This is done by adding a work_struct for each cpu and then
    doing the actual test/release on each affected cpu via schedule_work_on().
    
    Test results using 4 network namespaces and null encryption:
    
    ns1           ns2          -> ns3           -> ns4
    netperf -> xfrm/null enc   -> xfrm/null dec -> netserver
    
    what                    TCP_STREAM      UDP_STREAM      UDP_RR
    Flow cache:             14644.61        294.35          327231.64
    No flow cache:		14349.81	242.64		202301.72
    Pcpu cache:		14629.70	292.21		205595.22
    
    UDP tests used 64byte packets, tests ran for one minute each,
    value is average over ten iterations.
    
    'Flow cache' is 'net-next', 'No flow cache' is net-next plus this
    series but without this patch.
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ec30d78c
xfrm.h 52.7 KB