public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Waiman Long <waiman.long@hpe.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Jan Kara <jack@suse.com>, Jeff Layton <jlayton@poochiereds.net>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Christoph Lameter <cl@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andi Kleen <andi@firstfloor.org>,
	Dave Chinner <dchinner@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Scott J Norton <scott.norton@hpe.com>,
	Douglas Hatch <doug.hatch@hpe.com>
Subject: Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists
Date: Thu, 14 Jul 2016 13:41:03 -0400	[thread overview]
Message-ID: <20160714174103.GO15005@htj.duckdns.org> (raw)
In-Reply-To: <5787C834.9060609@hpe.com>

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

  reply	other threads:[~2016-07-14 17:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11 17:32 [PATCH v2 0/7] vfs: Use dlock list for SB's s_inodes list Waiman Long
2016-07-11 17:32 ` [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists Waiman Long
2016-07-13 16:08   ` Tejun Heo
2016-07-14  2:54     ` Waiman Long
2016-07-14 11:50       ` Tejun Heo
2016-07-14 14:35         ` Jan Kara
2016-07-14 14:51           ` Tejun Heo
2016-07-14 16:16             ` Waiman Long
2016-07-14 17:13         ` Waiman Long
2016-07-14 17:41           ` Tejun Heo [this message]
2016-07-11 17:32 ` [PATCH v2 2/7] lib/dlock-list: Add __percpu modifier for parameters Waiman Long
2016-07-13 16:08   ` Tejun Heo
2016-07-14  2:54     ` Waiman Long
2016-07-11 17:32 ` [PATCH v2 3/7] fsnotify: Simplify inode iteration on umount Waiman Long
2016-07-11 17:32 ` [PATCH v2 4/7] vfs: Remove unnecessary list_for_each_entry_safe() variants Waiman Long
2016-07-11 17:32 ` [PATCH v2 5/7] vfs: Use dlock list for superblock's inode list Waiman Long
2016-07-11 17:32 ` [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple per-subnode APIs Waiman Long
2016-07-12  3:14   ` Boqun Feng
2016-07-12 18:37     ` Waiman Long
2016-07-12 14:27   ` Tejun Heo
2016-07-12 18:51     ` Waiman Long
2016-07-12 18:57       ` Tejun Heo
2016-07-12 19:42         ` Waiman Long
2016-07-11 17:32 ` [RFC PATCH v2 7/7] lib/dlock-list: Use the per-subnode APIs for managing lists Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160714174103.GO15005@htj.duckdns.org \
    --to=tj@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=bfields@fieldses.org \
    --cc=boqun.feng@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=dchinner@redhat.com \
    --cc=doug.hatch@hpe.com \
    --cc=jack@suse.com \
    --cc=jlayton@poochiereds.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=scott.norton@hpe.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=waiman.long@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox