]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
xfrm: Let the flowcache handle its size by default.
authorSteffen Klassert <steffen.klassert@secunet.com>
Tue, 29 Sep 2015 09:40:49 +0000 (11:40 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 29 Sep 2015 09:44:16 +0000 (11:44 +0200)
The xfrm flowcache size is limited by the flowcache limit
(4096 * number of online cpus) and the xfrm garbage collector
threshold (2 * 32768), whatever is reached first. This means
that we can hit the garbage collector limit only on systems
with more than 16 cpus. On such systems we simply refuse
new allocations if we reach the limit, so new flows are dropped.
On syslems with 16 or less cpus, we hit the flowcache limit.
In this case, we shrink the flow cache instead of refusing new
flows.

We increase the xfrm garbage collector threshold to INT_MAX
to get the same behaviour, independent of the number of cpus.

The xfrm garbage collector threshold can still be set below
the flowcache limit to reduce the memory usage of the flowcache.

Tested-by: Dan Streetman <dan.streetman@canonical.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Documentation/networking/ip-sysctl.txt
net/ipv4/xfrm4_policy.c
net/ipv6/xfrm6_policy.c

index ebe94f2cab9811e62f0ea1d64c0d6c75838d0367..260f30b2def61934ccf047383b2cdf8e00ca7770 100644 (file)
@@ -1199,7 +1199,8 @@ tag - INTEGER
 xfrm4_gc_thresh - INTEGER
        The threshold at which we will start garbage collecting for IPv4
        destination cache entries.  At twice this value the system will
-       refuse new allocations.
+       refuse new allocations. The value must be set below the flowcache
+       limit (4096 * number of online cpus) to take effect.
 
 igmp_link_local_mcast_reports - BOOLEAN
        Enable IGMP reports for link local multicast groups in the
@@ -1645,7 +1646,8 @@ ratelimit - INTEGER
 xfrm6_gc_thresh - INTEGER
        The threshold at which we will start garbage collecting for IPv6
        destination cache entries.  At twice this value the system will
-       refuse new allocations.
+       refuse new allocations. The value must be set below the flowcache
+       limit (4096 * number of online cpus) to take effect.
 
 
 IPv6 Update by:
index 0304d1680ca24048d3aeff551dfe2584706c0d6d..75e8d48c03fb185b031e42e655b9ad4c10374bdd 100644 (file)
@@ -246,7 +246,7 @@ static struct dst_ops xfrm4_dst_ops = {
        .destroy =              xfrm4_dst_destroy,
        .ifdown =               xfrm4_dst_ifdown,
        .local_out =            __ip_local_out,
-       .gc_thresh =            32768,
+       .gc_thresh =            INT_MAX,
 };
 
 static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
index 30caa289c5dbf589270768ce90d15f2990341231..2fad59320b6c32d74a37f5dafe5764de216bdee8 100644 (file)
@@ -287,7 +287,7 @@ static struct dst_ops xfrm6_dst_ops = {
        .destroy =              xfrm6_dst_destroy,
        .ifdown =               xfrm6_dst_ifdown,
        .local_out =            __ip6_local_out,
-       .gc_thresh =            32768,
+       .gc_thresh =            INT_MAX,
 };
 
 static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {