[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: <>
References: <> <> <>
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

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>

Visit Openswan at
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page:
PGP Key:

Attachment: p
Description: Text document

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