public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Muhammad Falak R Wani <falakreyaz@gmail.com>,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	target-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing.
Date: Mon, 2 May 2016 11:06:44 -0700	[thread overview]
Message-ID: <20160502180644.GF3512@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160502175950.GA16580@infradead.org>

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 = (uintptr_t)(v); \
> > +	\
> > +	if (__builtin_constant_p(v) && (_r_a_p__v) == (uintptr_t)NULL) \
> > +		WRITE_ONCE((p), (typeof(p))(_r_a_p__v)); \
> > +	else \
> > +		smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
> > +	_r_a_p__v; \
> > +})
> 
> Can't we turn it into an inline (would need different calling
> conventions for p, though).

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?

							Thanx, Paul

  reply	other threads:[~2016-05-02 18:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-01 12:52 [PATCH 2/2] target: use RCU_INIT_POINTER() when NULLing Muhammad Falak R Wani
2016-05-01 12:52 ` [PATCH 1/2] " Muhammad Falak R Wani
2016-05-01 17:01 ` [PATCH 2/2] " Christoph Hellwig
2016-05-01 19:53   ` Paul E. McKenney
2016-05-02 14:10     ` Paul E. McKenney
2016-05-02 17:57       ` Paul E. McKenney
2016-05-02 17:59         ` Christoph Hellwig
2016-05-02 18:06           ` Paul E. McKenney [this message]
2016-05-03  8:45             ` Christoph Hellwig
2016-05-03 13:07               ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160502180644.GF3512@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=falakreyaz@gmail.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox