From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754758AbbE1VGE (ORCPT ); Thu, 28 May 2015 17:06:04 -0400 Received: from smtprelay0156.hostedemail.com ([216.40.44.156]:56474 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754489AbbE1VFq (ORCPT ); Thu, 28 May 2015 17:05:46 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:1981:2194:2198:2199:2200:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3870:3871:3872:5007:6261:7875:7903:9010:10004:10400:10848:10967:11026:11232:11658:11914:12114:12438:12517:12519:12740:13069:13311:13357:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: smoke03_14ee8006eff22 X-Filterd-Recvd-Size: 1857 Date: Thu, 28 May 2015 17:05:42 -0400 From: Steven Rostedt To: Dan Streetman Cc: Andrew Morton , "Paul E. McKenney" , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] rcu: introduce list_last_or_null_rcu Message-ID: <20150528170542.3b3a7b48@gandalf.local.home> In-Reply-To: <1432845328-27932-1-git-send-email-ddstreet@ieee.org> References: <1432845328-27932-1-git-send-email-ddstreet@ieee.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 May 2015 16:35:27 -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. May I asked what this would be used for? It seems awfully inefficient in its implementation. What use cases would this be for? I hate to add something like this as a generic function which would encourage people to use it. Iterating over an entire list to find the last element is just nasty. -- Steve