From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbeBTNDR (ORCPT ); Tue, 20 Feb 2018 08:03:17 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:46634 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752131AbeBTNCJ (ORCPT ); Tue, 20 Feb 2018 08:02:09 -0500 Date: Tue, 20 Feb 2018 09:39:37 +0100 From: Peter Zijlstra To: John Ogness Cc: Linus Torvalds , linux-fsdevel , Al Viro , Christoph Hellwig , Thomas Gleixner , Sebastian Andrzej Siewior , Linux Kernel Mailing List , hjl.tools@gmail.com Subject: Re: [PATCH 4/4] fs/dcache: Avoid the try_lock loops in dentry_kill() Message-ID: <20180220083937.GX25201@hirez.programming.kicks-ass.net> References: <20180216150933.971-1-john.ogness@linutronix.de> <20180216150933.971-5-john.ogness@linutronix.de> <87y3js36s7.fsf@linutronix.de> <87r2pk358g.fsf@linutronix.de> <87lgfs3374.fsf@linutronix.de> <878tbov9i6.fsf@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878tbov9i6.fsf@linutronix.de> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 20, 2018 at 12:34:57AM +0100, John Ogness wrote: > Implementation 2: Using switch on a dentry_lock_inode() that returns a > tristate value. Does not support branch prediction. This approach is > probably easiest to understand. > > /* > * Lock the inode. Might drop dentry->d_lock temporarily > * which allows inode to change. Start over if that happens. > */ > switch (dentry_lock_inode(dentry)) { > case LOCK_FAST: Bah, I just checked, you cannot use GCC label attributes on statements :/ Otherwise you could've done: case LOCK_FAST: __attribute__((hot)); > break; > case LOCK_SLOW: > /* > * Recheck refcount as it might have been > * incremented while d_lock was dropped. > */ > if (unlikely(dentry->d_lockref.count != 1)) > goto drop_ref; > break; > case LOCK_FAILED: > goto again; > } >