]> git.baikalelectronics.ru Git - kernel.git/commit
net: implement emergency route cache rebulds when gc_elasticity is exceeded
authorNeil Horman <nhorman@tuxdriver.com>
Mon, 27 Oct 2008 19:28:25 +0000 (12:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Oct 2008 00:06:14 +0000 (17:06 -0700)
commit17c4cc476c567f3d26a7bb21988b6ef8148c84c1
treeb87a162b10d98f7d44657d7c9a98bbc7385159fd
parent3c0d6c7727ffd2ab82c276e466d2ac86d8b1c6d7
net: implement emergency route cache rebulds when gc_elasticity is exceeded

This is a patch to provide on demand route cache rebuilding.  Currently, our
route cache is rebulid periodically regardless of need.  This introduced
unneeded periodic latency.  This patch offers a better approach.  Using code
provided by Eric Dumazet, we compute the standard deviation of the average hash
bucket chain length while running rt_check_expire.  Should any given chain
length grow to larger that average plus 4 standard deviations, we trigger an
emergency hash table rebuild for that net namespace.  This allows for the common
case in which chains are well behaved and do not grow unevenly to not incur any
latency at all, while those systems (which may be being maliciously attacked),
only rebuild when the attack is detected.  This patch take 2 other factors into
account:
1) chains with multiple entries that differ by attributes that do not affect the
hash value are only counted once, so as not to unduly bias system to rebuilding
if features like QOS are heavily used
2) if rebuilding crosses a certain threshold (which is adjustable via the added
sysctl in this patch), route caching is disabled entirely for that net
namespace, since constant rebuilding is less efficient that no caching at all

Tested successfully by me.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/ip-sysctl.txt
include/net/netns/ipv4.h
net/ipv4/route.c
net/ipv4/sysctl_net_ipv4.c