From: Martin Josefsson <gandalf@xxxxxxxxxxxxxx>
Date: Sat, 19 Jan 2002 19:50:14 +0100 (CET)
I've been playing around a little trying to improve the performance
of iptables connectiontracking and in one test (flood with random source
ip's) I noticed that there are alot of searches in the routingcache
(this is because of all the cachemisses). this second search in
rt_intern_hash() isn't needed on UP AFAIK. No other cpu can insert entries
in the routingcache while we prepare the new entry to be inserted.
I'm apply this part, thanks.
And it fixes what I think is a small bug on SMP. We dereference
rt_hash_table[hash].chain before taking the lock. what if it changes
before we start the search, ie. we have to wait for the lock and when we
get to run it's been changed by another cpu.
It takes "address of" chain, not chain. There is no bug :)
Franks a lot,
David S. Miller