[Top] [All Lists]

Re: atomic_dec_and_test for child dst needed in dst_destroy?

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: atomic_dec_and_test for child dst needed in dst_destroy?
From: Christoph Lameter <christoph@xxxxxxxxxxx>
Date: Tue, 5 Apr 2005 20:19:55 -0700 (PDT)
Cc: netdev@xxxxxxxxxxx, davem@xxxxxxxxxxxxx
In-reply-to: <>
References: <>
Sender: netdev-bounce@xxxxxxxxxxx
On Wed, 6 Apr 2005, Herbert Xu wrote:

> Christoph Lameter <christoph@xxxxxxxxxxx> wrote:
> >
> > If that is so then it is also possible that the gc frees after
> > atomic_dec_and_test:
> No this is prevented by the nohash check.

Ok then the purpose of this whole thing is to decrement the usage counter
and at the same time figure out if this is the last child on an unhashed
entry. That unhashed entry is not handled by the garbage collector and
must be freed separately.

The atomic_dec_and_test is needed because as soon as the refcnt reaches
zero the dst entry may potentially be freed by the garbage collector. Thus
no future access to the dst entry is possible and the dec_and_test is the
only safe way to figure out if the counter reached zero.

I hope I got it now. Thanks.

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