Re: Multi-threading

Rusty Russell (rusty@rustcorp.com.au)
Thu, 14 Mar 2002 15:50:49 +1100


On Wed, 13 Mar 2002 09:23:06 +0100
Andi Kleen <ak@suse.de> wrote:

> On Tue, Mar 12, 2002 at 11:51:29PM -0800, David Schwartz wrote:
> >
> > >Just it might change immediately afterwards if you don't remove the
> > >object from public view first.
> >
> > If it was in public view, whatever held it in public view would be
> > using it, and hence its use count could not drop to zero.
>
> That's not correct at least in the usual linux kernel pattern of using
> reference counts for objects. Hash tables don't hold reference counts,
> only users do. If you think about it a hash table or global list holding
> a reference count doesn't make too much sense.

Depends where you are talking. In the conntrack code (and I thought the
rest of the networking code), 0 means "free me now, NOONE has a pointer",
ie. the hash table holds 1.

dcache holds zero-count entries because their semantic requirements are
different, hence the "atomic_dec_and_lock()" stuff.

Cheers!
Rusty.

-- 
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/