Re: kref refcnt and false positives

From: Andrew Morton
Date: Thu Dec 14 2006 - 19:35:52 EST


On Thu, 14 Dec 2006 17:19:55 -0700
ebiederm@xxxxxxxxxxxx (Eric W. Biederman) wrote:

> "Pallipadi, Venkatesh" <venkatesh.pallipadi@xxxxxxxxx> writes:
>
> >>But I believe Venkatesh problem comes from its release()
> >>function : It is
> >>supposed to free the object.
> >>If not, it should properly setup it so that further uses are OK.
> >>
> >>ie doing in release(kref)
> >>atomic_set(&kref->count, 0);
> >>
> >
> > Agreed that setting kref refcnt to 0 in release will solve the probloem.
> > But, once the optimization code is removed, we don't need to set it to
> > zero as release will only be called after the count reaches zero anyway.
>
> The primary point of the optimization is to not write allocate a cache line
> unnecessarily. I don't know it's value, but it can have one especially
> on big way SMP machines.

Guys, we have about 1000000000000000000000000000000 reports of weirdo
crashes, smashes, bashes and splats in the kref code. The last thing we
need is some obscure, tricksy little optimisation which leads legitimate
uses of the API to mysteriously fail.

If we are allocating and freeing kref-counted objects at a sufficiently
high frequency for this thing to make a difference then we should fix that
instead of trying to suck faster.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/