[IPV4] FIB_HASH : Avoid unecessary loop in fn_hash_dump_zone()
authorEric Dumazet <dada1@cosmosbay.com>
Fri, 18 Jan 2008 12:30:21 +0000 (04:30 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Jan 2008 04:31:39 +0000 (20:31 -0800)
commit8d3f099abe25c21670cb5728178a1f286952782d
tree074339fd500a3af4f89cab67c0a90bae81bc93a7
parent49d85c502ec5e6d5998c1a04394c5b24e8f7d32d
[IPV4] FIB_HASH : Avoid unecessary loop in fn_hash_dump_zone()

I noticed "ip route list" was slower than "cat /proc/net/route" on a
machine with a full Internet routing table (214392 entries : Special
thanks to Robert ;) )

This is similar to problem reported in commit
d8c9283089287341c85a0a69de32c2287a990e71 ("[IPV4] ROUTE: ip_rt_dump()
is unecessary slow")

Fix is to avoid scanning the begining of fz_hash table, but directly
seek to the right offset.

Before patch :

time ip route >/tmp/ROUTE

real    0m1.285s
user    0m0.712s
sys     0m0.436s

After patch

# time ip route >/tmp/ROUTE

real    0m0.835s
user    0m0.692s
sys     0m0.124s

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fib_hash.c