]> git.baikalelectronics.ru Git - kernel.git/commit
[IPV4] route cache: Introduce rt_genid for smooth cache invalidation
authorEric Dumazet <dada1@cosmosbay.com>
Fri, 1 Feb 2008 01:05:09 +0000 (17:05 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Feb 2008 03:28:27 +0000 (19:28 -0800)
commitc41fb46f9b6b82f06ed11be1f685da255c9c9a8d
treeaffd152c959eede937b50f6054a303a388a88545
parentaeebbf2aa62b3b0b5c5cf767f026f3a370207255
[IPV4] route cache: Introduce rt_genid for smooth cache invalidation

Current ip route cache implementation is not suited to large caches.

We can consume a lot of CPU when cache must be invalidated, since we
currently need to evict all cache entries, and this eviction is
sometimes asynchronous. min_delay & max_delay can somewhat control this
asynchronism behavior, but whole thing is a kludge, regularly triggering
infamous soft lockup messages. When entries are still in use, this also
consumes a lot of ram, filling dst_garbage.list.

A better scheme is to use a generation identifier on each entry,
so that cache invalidation can be performed by changing the table
identifier, without having to scan all entries.
No more delayed flushing, no more stalling when secret_interval expires.

Invalidated entries will then be freed at GC time (controled by
ip_rt_gc_timeout or stress), or when an invalidated entry is found
in a chain when an insert is done.
Thus we keep a normal equilibrium.

This patch :
- renames rt_hash_rnd to rt_genid (and makes it an atomic_t)
- Adds a new rt_genid field to 'struct rtable' (filling a hole on 64bit)
- Checks entry->rt_genid at appropriate places :
Documentation/filesystems/proc.txt
include/linux/sysctl.h
include/net/route.h
net/ipv4/route.c