Re: [patch 2/2] lockdep: initialize lockdep debugging statistics

From: Peter Zijlstra
Date: Fri Mar 06 2009 - 05:19:35 EST


On Fri, 2009-03-06 at 01:56 -0800, David Rientjes wrote:
>
> Peter, this is purely a matter of good software engineering practices.

For complex types I would agree, but atomic_t is assumed to be just
another int - just with special ops. For such things we can hold that
memset('0') will properly initialize them to their 0 value.

> I
> hadn't realized you were so passionate about avoiding initialization of
> global atomic_t variables,

Given that static/global storage is properly initialized to 0, and the
above, it seems to be redundant.

> I assume you wouldn't object to removing all such cases in the kernel.
>
> $ grep -r "atomic_t.*= ATOMIC_INIT(0)" * | wc -l
> 104

Only IFF all those cases are for static/global storage. Otherwise you
have to ensure 0-ness by either using __GFP_ZERO or explicit
initialization.

--
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/