From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f177.google.com ([209.85.161.177]:35561 "EHLO mail-yw0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbcGNRlG (ORCPT ); Thu, 14 Jul 2016 13:41:06 -0400 Date: Thu, 14 Jul 2016 13:41:03 -0400 From: Tejun Heo To: Waiman Long Cc: Alexander Viro , Jan Kara , Jeff Layton , "J. Bruce Fields" , Christoph Lameter , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Andi Kleen , Dave Chinner , Boqun Feng , Scott J Norton , Douglas Hatch Subject: Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists Message-ID: <20160714174103.GO15005@htj.duckdns.org> References: <1468258332-61537-1-git-send-email-Waiman.Long@hpe.com> <1468258332-61537-2-git-send-email-Waiman.Long@hpe.com> <20160713160823.GD4065@mtj.duckdns.org> <5786FEDB.9080107@hpe.com> <20160714115043.GD15005@htj.duckdns.org> <5787C834.9060609@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5787C834.9060609@hpe.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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