LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: shemminger@vyatta.com, paulmck@us.ibm.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fib_trie: rcu_assign_pointer warning fix
Date: Tue, 12 Feb 2008 08:57:14 +0000	[thread overview]
Message-ID: <20080212085714.GB2582@ff.dom.local> (raw)
In-Reply-To: <20080211.171645.74019568.davem@davemloft.net>

On 12-02-2008 02:16, David Miller wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Mon, 11 Feb 2008 16:59:54 -0800
> 
> linux-kernel added to CC:, any change to generic kernel infrastructure
> should be posted there
> 
>> Eliminate warnings when rcu_assign_pointer is used with unsigned long.
>> It is reasonable to use RCU with non-pointer values so allow it for general
>> use.  Add a comment to explain the if test.
>>
>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>> ---
>>  include/linux/rcupdate.h |   13 +++++++------
>>  1 files changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
>> index 37a642c..c44ac87 100644
>> --- a/include/linux/rcupdate.h
>> +++ b/include/linux/rcupdate.h
>> @@ -172,14 +172,15 @@ struct rcu_head {
>>   * structure after the pointer assignment.  More importantly, this
>>   * call documents which pointers will be dereferenced by RCU read-side
>>   * code.
>> + *
>> + * If value is the NULL (constant 0), then no barrier is needed.
>>   */
>>  
>> -#define rcu_assign_pointer(p, v) \
>> -	({ \
>> -		if (!__builtin_constant_p(v) || \
>> -		    ((v) != NULL)) \
>> -			smp_wmb(); \
>> -		(p) = (v); \
>> +#define rcu_assign_pointer(p, v)			\
>> +	({						\
>> +		if (!(__builtin_constant_p(v) && v))	\

...But, "If value is the NULL (constant 0)" we have:

if (!(1 && NULL != 0)) ==> if (!(0)) and the barrier is used?!

>> +			smp_wmb();			\
>> +		(p) = (v);				\
>>  	})
>>  
>>  /**


Regards,
Jarek P.

  reply	other threads:[~2008-02-12  8:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080211165954.2f1b3a9b@extreme>
2008-02-12  1:16 ` David Miller
2008-02-12  8:57   ` Jarek Poplawski [this message]
2008-02-12 16:07     ` Paul E. McKenney
2008-02-12 19:32       ` Jarek Poplawski
2008-02-12 19:46         ` Jarek Poplawski
2008-02-13 22:55           ` Paul E. McKenney
     [not found] ` <20080212012741.GD29254@linux.vnet.ibm.com>
2008-02-12  5:15   ` David Miller
2008-02-12  1:18 Stephen Hemminger

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=20080212085714.GB2582@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@us.ibm.com \
    --cc=shemminger@vyatta.com \
    --subject='Re: [PATCH] fib_trie: rcu_assign_pointer warning fix' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).