lkml.org 
[lkml]   [2015]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] rcu: introduce list_last_or_null_rcu
On Thu, 28 May 2015 16:35:27 -0400
Dan Streetman <ddstreet@ieee.org> 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



\
 
 \ /
  Last update: 2015-05-28 23:21    [W:0.065 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site