From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754687AbbCYOaa (ORCPT ); Wed, 25 Mar 2015 10:30:30 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:50371 "EHLO e38.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275AbbCYOaZ (ORCPT ); Wed, 25 Mar 2015 10:30:25 -0400 Date: Wed, 25 Mar 2015 07:30:18 -0700 From: "Paul E. McKenney" To: Patrick Marlier Cc: linux-kernel@vger.kernel.org, Josh Triplett Subject: Re: [PATCH 1/3] rculist: Fix list_entry_rcu to read ptr with rcu_dereference_raw Message-ID: <20150325143018.GZ5718@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <55113D0A.2030302@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55113D0A.2030302@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15032514-0029-0000-0000-000008BCA4C2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2015 at 11:31:38AM +0100, Patrick Marlier wrote: > Change to read effectively ptr with rcu_dereference_raw and not the > __ptr variable on the stack. > > Signed-off-by: Patrick Marlier Avoiding an extra load could be worthwhile in a number of situations, agreed. However, won't this change cause sparse to complain if invoked on a non-RCU-protected pointer? The ability to use list-RCU API members on both RCU and non-RCU pointers was one of the points of the previous commit, right? Thanx, Paul > --- > include/linux/rculist.h | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/include/linux/rculist.h b/include/linux/rculist.h > index a18b16f..9d9baea 100644 > --- a/include/linux/rculist.h > +++ b/include/linux/rculist.h > @@ -247,10 +247,7 @@ static inline void list_splice_init_rcu(struct > list_head *list, > * primitives such as list_add_rcu() as long as it's guarded by > rcu_read_lock(). > */ > #define list_entry_rcu(ptr, type, member) \ > -({ \ > - typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \ > - container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \ > -}) > + container_of((typeof(ptr))rcu_dereference_raw(ptr), type, member) > > /** > * Where are list_empty_rcu() and list_first_entry_rcu()? > -- > 2.1.0 >