[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180220083937.GX25201@hirez.programming.kicks-ass.net>
Date: Tue, 20 Feb 2018 09:39:37 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: John Ogness <john.ogness@...utronix.de>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@....de>,
Thomas Gleixner <tglx@...utronix.de>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
hjl.tools@...il.com
Subject: Re: [PATCH 4/4] fs/dcache: Avoid the try_lock loops in dentry_kill()
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;
> }
>
Powered by blists - more mailing lists