netdev
[Top] [All Lists]

Re: [PATCH] make rt_intern_hash() don't search yet another time on UP

To: gandalf@xxxxxxxxxxxxxx
Subject: Re: [PATCH] make rt_intern_hash() don't search yet another time on UP
From: "David S. Miller" <davem@xxxxxxxxxx>
Date: Wed, 23 Jan 2002 06:51:55 -0800 (PST)
Cc: netdev@xxxxxxxxxxx
In-reply-to: <Pine.LNX.4.21.0201191938280.15524-100000@xxxxxxxxxxxxxx>
References: <Pine.LNX.4.21.0201191938280.15524-100000@xxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
   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
davem@xxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>