From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754945AbbE1VRr (ORCPT ); Thu, 28 May 2015 17:17:47 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:35338 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754880AbbE1VRh (ORCPT ); Thu, 28 May 2015 17:17:37 -0400 Date: Thu, 28 May 2015 14:17:31 -0700 From: "Paul E. McKenney" To: Dan Streetman Cc: Josh Triplett , Andrew Morton , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , linux-kernel Subject: Re: [PATCH 1/2] rcu: introduce list_last_or_null_rcu Message-ID: <20150528211731.GP5989@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1432845328-27932-1-git-send-email-ddstreet@ieee.org> <20150528203938.GA31076@cloud> <20150528210546.GM5989@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15052821-0021-0000-0000-00000AEDE8CA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2015 at 05:14:25PM -0400, Dan Streetman wrote: > On Thu, May 28, 2015 at 5:05 PM, Paul E. McKenney > wrote: > > On Thu, May 28, 2015 at 04:42:20PM -0400, Dan Streetman wrote: > >> On Thu, May 28, 2015 at 4:39 PM, wrote: > >> > On Thu, May 28, 2015 at 04:35:27PM -0400, Dan Streetman wrote: > >> >> Add list_last_or_null_rcu(), to simplify getting the last entry from a > >> >> rcu-protected list. The standard list_last_entry() can't be used as it > >> >> is not rcu-protected; the list may be modified concurrently. And the > >> >> ->prev pointer can't be used, as only the ->next pointers are protected > >> >> by rcu. > >> >> > >> >> This simply iterates forward through the entire list, to get to the last > >> >> entry. If the list is empty, it returns NULL. > >> >> > >> >> Signed-off-by: Dan Streetman > >> > > >> > The list iteration functions are macros because they introduce a loop > >> > with attached loop block. For this, is there any reason not to make it > >> > an inline function instead of a macro? > >> > >> true, there's no reason i can see not to make it inline, let me send > >> an updated patch. > > > > Hmmm... If we can now do type-generic inline functions, it might make > > sense to convert some of the others as well. > > oh, ok. how do we do type-generic inline funcs? return void*? I was hoping that you would tell me. I use macros in that case. Thanx, Paul