[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080212012741.GD29254@linux.vnet.ibm.com>
Date: Mon, 11 Feb 2008 17:27:41 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Stephen Hemminger <shemminger@...tta.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH] fib_trie: rcu_assign_pointer warning fix
On Mon, Feb 11, 2008 at 04:59:54PM -0800, Stephen Hemminger wrote:
> 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.
Good catch!!! (An apologies for the hassle!!!)
Acked-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> Signed-off-by: Stephen Hemminger <shemminger@...tta.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)) \
> + smp_wmb(); \
> + (p) = (v); \
> })
>
> /**
> --
> 1.5.3.8
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists