netdev
[Top] [All Lists]

Re: atomic_dec_and_test for child dst needed in dst_destroy?

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: Re: atomic_dec_and_test for child dst needed in dst_destroy?
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 7 Apr 2005 21:07:24 +1000
Cc: christoph@xxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20050406111721.3ac67605.davem@davemloft.net>
References: <Pine.LNX.4.58.0504051925250.21486@graphe.net> <E1DJ5y2-0003rF-00@gondolin.me.apana.org.au> <20050406111721.3ac67605.davem@davemloft.net>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
On Wed, Apr 06, 2005 at 11:17:21AM -0700, David S. Miller wrote:
> 
> See his other emails in this thread.  If it can be converted to
> atomic_dec() then he wants to change the counter into an array
> of counters on NUMA systems.
> 
> But his trick only works if the atomic_dec_and_test() can be eliminated
> for all cases, which we're now quite certain is not possible.

OK I've thought more about this and indeed it is possible to get rid of
atomic_dec_and_test.

As you can see from my previous patch, it is possible to restrict the
use of atomic_dec_and_test to the NOHASH path.

However, for NOHASH dst entries we know that

1) They're not in a hash table.
2) They're not on the GC list.

Therefore it is safe to look at the entry even after dropping our
reference count.

This is what the following patch does.

I added the unlikely on dst since entries with child pointers are
rare in most systems.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Attachment: p
Description: Text document

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