Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443638

Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists
Date 2016-07-14 19:50 +0200
Message-ID <rUSVP-4ga-5@gated-at.bofh.it> (permalink)
References (1 earlier) <rTNlv-1Jn-15@gated-at.bofh.it> <rUv3b-5rv-5@gated-at.bofh.it> <rUNt8-N5-21@gated-at.bofh.it> <rUNt8-N5-19@gated-at.bofh.it> <rUSVP-4ga-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/7] vfs: Use dlock list for SB's s_inodes list Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [RFC PATCH v2 7/7] lib/dlock-list: Use the per-subnode APIs for managing lists Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
    Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-13 18:20 +0200
      Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-14 14:00 +0200
        Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Jan Kara <jack@suse.cz> - 2016-07-14 16:40 +0200
          Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-14 17:00 +0200
        Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-14 19:50 +0200
  [PATCH v2 2/7] lib/dlock-list: Add __percpu modifier for parameters Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
    Re: [PATCH v2 2/7] lib/dlock-list: Add __percpu modifier for  parameters Tejun Heo <tj@kernel.org> - 2016-07-13 18:20 +0200
  [PATCH v2 5/7] vfs: Use dlock list for superblock's inode list Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [PATCH v2 3/7] fsnotify: Simplify inode iteration on umount Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple per-subnode APIs Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
    Re: [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple  per-subnode APIs Boqun Feng <boqun.feng@gmail.com> - 2016-07-12 05:20 +0200
    Re: [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple  per-subnode APIs Tejun Heo <tj@kernel.org> - 2016-07-12 16:30 +0200
      Re: [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple  per-subnode APIs Tejun Heo <tj@kernel.org> - 2016-07-12 21:00 +0200

csiph-web