Re: [PATCH tip/core/rcu 04/14] rcu: Add a gcc-style structureinitializer for RCU pointers

From: Josh Triplett
Date: Fri Jun 15 2012 - 17:50:35 EST


On Fri, Jun 15, 2012 at 01:48:13PM -0700, Josh Triplett wrote:
> On Fri, Jun 15, 2012 at 01:13:05PM -0700, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
> >
> > RCU_INIT_POINTER() returns a value that is never used, and which should
> > be abolished due to terminal ugliness:
> >
> > q = RCU_INIT_POINTER(global_p, p);
> >
> > However, there are two uses that cannot be handled by a do-while
> > formulation because they do gcc-style initialization:
> >
> > RCU_INIT_POINTER(.real_cred, &init_cred),
> > RCU_INIT_POINTER(.cred, &init_cred),
> >
> > This usage is clever, but not necessarily the nicest approach. This
> > commit therefore creates an INIT_RCU_POINTER() macro that is specifically
> > designed for gcc-style initialization.
>
> The concept seems fine, but the names seem entirely non-obvious.
> RCU_INIT_POINTER versus INIT_RCU_POINTER?

Suggestion: RCU_POINTER_INITIALIZER, following the example of many other
*_INITIALIZER macros elsewhere in the kernel.

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