netdev
[Top] [All Lists]

Re: atomic_dec_and_test for child dst needed in dst_destroy?

To: Christoph Lameter <christoph@xxxxxxxxxxx>
Subject: Re: atomic_dec_and_test for child dst needed in dst_destroy?
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Apr 2005 09:07:38 +1000
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, pravins@xxxxxxxxxxxxxx, shai@xxxxxxxxxxxxx
In-reply-to: <Pine.LNX.4.58.0504071520050.3983@xxxxxxxxxx>
References: <Pine.LNX.4.58.0504051925250.21486@xxxxxxxxxx> <E1DJ5y2-0003rF-00@xxxxxxxxxxxxxxxxxxxxxxxx> <20050406111721.3ac67605.davem@xxxxxxxxxxxxx> <20050407110724.GA8760@xxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.58.0504070842420.29731@xxxxxxxxxx> <20050407212504.GA4939@xxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.58.0504071520050.3983@xxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
On Thu, Apr 07, 2005 at 03:30:28PM -0700, Christoph Lameter wrote:
> 
> So in case f.e. the refcnt was 2 for a child NOHASH entry, then we
> decrement the refcnt for the child but do not free it. However after
> dst_destroy the parent is gone and presumably some skb->dst are still
> pointing to the dst entry (or is there something else accounting for the
> remaining __refcnt)?
> 
> What happens to the child dst entry? Will the system simply never
> deallocate it?

If the refcnt is non-zero after the atomic_dec and the entry is NOHASH,
we return it and the caller will add it to the GC list.

See the relevant section in dst_run_gc and dst_free.

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

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