Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-03 Thread Paul E. McKenney
On Tue, May 03, 2016 at 01:45:20AM -0700, Christoph Hellwig wrote: > On Mon, May 02, 2016 at 11:06:44AM -0700, Paul E. McKenney wrote: > > And for v. But how do I do that without C++ templates? > > > > Also, does __builtin_constant_p() work reliably on a parameter? > > Especially when the compile

Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-03 Thread Christoph Hellwig
On Mon, May 02, 2016 at 11:06:44AM -0700, Paul E. McKenney wrote: > And for v. But how do I do that without C++ templates? > > Also, does __builtin_constant_p() work reliably on a parameter? > Especially when the compiler decides not to do the inlining? Yeah, it's going to be a pain indeed, gues

Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-02 Thread Paul E. McKenney
On Mon, May 02, 2016 at 10:59:50AM -0700, Christoph Hellwig wrote: > On Mon, May 02, 2016 at 10:57:38AM -0700, Paul E. McKenney wrote: > > -#define rcu_assign_pointer(p, v) smp_store_release(&p, RCU_INITIALIZER(v)) > > +#define rcu_assign_pointer(p, v) \ > > +({ \ > > + uintptr_t _r_a_p__v = (uin

Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-02 Thread Christoph Hellwig
On Mon, May 02, 2016 at 10:57:38AM -0700, Paul E. McKenney wrote: > -#define rcu_assign_pointer(p, v) smp_store_release(&p, RCU_INITIALIZER(v)) > +#define rcu_assign_pointer(p, v) \ > +({ \ > + uintptr_t _r_a_p__v = (uintptr_t)(v); \ > + \ > + if (__builtin_constant_p(v) && (_r_a_p__v)

Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-02 Thread Paul E. McKenney
On Mon, May 02, 2016 at 07:10:23AM -0700, Paul E. McKenney wrote: > On Sun, May 01, 2016 at 12:53:13PM -0700, Paul E. McKenney wrote: > > On Sun, May 01, 2016 at 10:01:20AM -0700, Christoph Hellwig wrote: > > > On Sun, May 01, 2016 at 06:22:01PM +0530, Muhammad Falak R Wani wrote: > > > > It is saf

Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-02 Thread Paul E. McKenney
On Sun, May 01, 2016 at 12:53:13PM -0700, Paul E. McKenney wrote: > On Sun, May 01, 2016 at 10:01:20AM -0700, Christoph Hellwig wrote: > > On Sun, May 01, 2016 at 06:22:01PM +0530, Muhammad Falak R Wani wrote: > > > It is safe to use RCU_INIT_POINTER() to NULL, instead of > > > rcu_assign_pointer()

Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-01 Thread Paul E. McKenney
On Sun, May 01, 2016 at 10:01:20AM -0700, Christoph Hellwig wrote: > On Sun, May 01, 2016 at 06:22:01PM +0530, Muhammad Falak R Wani wrote: > > It is safe to use RCU_INIT_POINTER() to NULL, instead of > > rcu_assign_pointer(). > > This results in slightly smaller/faster code. > > If this is indeed

Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-01 Thread Christoph Hellwig
On Sun, May 01, 2016 at 06:22:01PM +0530, Muhammad Falak R Wani wrote: > It is safe to use RCU_INIT_POINTER() to NULL, instead of > rcu_assign_pointer(). > This results in slightly smaller/faster code. If this is indeed the case, rcu_assign_pointer should simply check for NULL using __builtin_cons

[PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.

2016-05-01 Thread Muhammad Falak R Wani
It is safe to use RCU_INIT_POINTER() to NULL, instead of rcu_assign_pointer(). This results in slightly smaller/faster code. Signed-off-by: Muhammad Falak R Wani --- drivers/target/target_core_tpg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/target_core_tp