From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751053AbeBPXtx (ORCPT ); Fri, 16 Feb 2018 18:49:53 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:57415 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750859AbeBPXtv (ORCPT ); Fri, 16 Feb 2018 18:49:51 -0500 From: John Ogness To: Linus Torvalds Cc: linux-fsdevel , Al Viro , Christoph Hellwig , Thomas Gleixner , Peter Zijlstra , Sebastian Andrzej Siewior , Linux Kernel Mailing List Subject: Re: [PATCH 4/4] fs/dcache: Avoid the try_lock loops in dentry_kill() References: <20180216150933.971-1-john.ogness@linutronix.de> <20180216150933.971-5-john.ogness@linutronix.de> <87y3js36s7.fsf@linutronix.de> <87r2pk358g.fsf@linutronix.de> Date: Sat, 17 Feb 2018 00:49:35 +0100 In-Reply-To: (Linus Torvalds's message of "Fri, 16 Feb 2018 15:31:22 -0800") Message-ID: <87lgfs3374.fsf@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-02-17, Linus Torvalds wrote: >> dentry_kill() calls both dentry_lock_inode() and lock_parent() in the >> common case. So by changing the semantics of lock_parent(), I am >> removing two "recheck in case I dropped" in the common case rather >> than just the one you pointed out. > > Ok, that would be lovely, but doesn't that end up being a nasty patch? After reading your initial feedback my idea was to change both lock_parent() and dentry_lock_inode() to not only communicate _if_ the lock was successful, but also if d_lock was dropped in the process. (For example, with a tristate rather than boolean return value.) Then callers would know if they needed to recheck the dentry contents. > So it may be that my dislike of the "re-check after possibly dropping > the lock" is not really about the re-checking, but about just how it > made that function look much more complicated. I understand what you are saying and I appreciate the comments. I will code up some variations for myself and try to pick the one that is the least complicated for my v2. John Ogness