lkml.org 
[lkml]   [2016]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists
Hello,

On Thu, Jul 14, 2016 at 01:13:24PM -0400, Waiman Long wrote:
> On 07/14/2016 07:50 AM, Tejun Heo wrote:
> I got comment related to the percpu-list name from Christoph Lameter a while
> ago. His argument was that since deletion can happenned from any CPU, it was
> not really percpu like the other percpu structures. That prompted me to
> change the name to the current form. I am fine with either names, but I
> would like to keep the current name unless there is a great rationale for
> switching back.

Yeah, I don't know. It's probably gonna stick out as a percpu data
structure with a weird name. No biggies. If it actually matters, we
can rename it later. Christoph, what do you think? Do you still
think dlist is a better name?

> > I don't think it makes sense to worry about the cases where the next
> > entry to iterate may be removed by the iterator. What I'm trying to
> > say is just make the iteration always safe and don't worry about the
> > distinction. For list_for_each_entry(), it makes the difference of
> > requiring and not requiring a separtae state variable. Here, we need
> > it anyway.
>
> A lot of those functions that need to iterate the list will release the lock
> in the middle, do some stuff, reacquire the lock and move on to the next
> entry. So it is entirely possible that new entries will be inserted between
> the current entry and the next one in between the release and re-acquisition
> of the lock. Using the safe version will skip those newly added entries
> which is a change in behavior for the current code. That is my main concern
> for making it deletion safe by default.

I see. The distinction between unsafe and safe versions is pretty
subtle. :(

> I don't think it is normal to have concurrent deletion of the same entry.
> Most likely it is a bug if this happens. Having the warning message in the
> kernel log will help to catch those errors.

Yeah, maybe. I was thinking more in line of list_del_init(). dlist
having its own locking embedded makes it a bit murky which parts of
synchronization belong where.

Thanks.

--
tejun

\
 
 \ /
  Last update: 2016-07-14 20:21    [W:0.060 / U:6.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site