From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932226AbbE1VKW (ORCPT ); Thu, 28 May 2015 17:10:22 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:46874 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754868AbbE1VKO (ORCPT ); Thu, 28 May 2015 17:10:14 -0400 Date: Thu, 28 May 2015 14:10:10 -0700 From: josh@joshtriplett.org To: Dan Streetman Cc: Andrew Morton , "Paul E. McKenney" , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , linux-kernel Subject: Re: [PATCH 1/2] rcu: introduce list_last_or_null_rcu Message-ID: <20150528211010.GA31229@cloud> References: <1432845328-27932-1-git-send-email-ddstreet@ieee.org> <20150528203938.GA31076@cloud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2015 at 04:44:59PM -0400, Dan Streetman wrote: > On Thu, May 28, 2015 at 4:42 PM, 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. > > ha, as soon as i sent that email, i realized it can't be an inline > function, because the return value is (type *), not a predefined > value. Of course it could return void*, but unless there's a benefit > of making it an inline function, it seems to me like it would be > better as a #define. Fair enough. Sigh, C. - Josh Triplett