From: Peter Zijlstra <peterz@infradead.org>
To: John Ogness <john.ogness@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@lst.de>,
Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
hjl.tools@gmail.com
Subject: Re: [PATCH 4/4] fs/dcache: Avoid the try_lock loops in dentry_kill()
Date: Tue, 20 Feb 2018 09:43:54 +0100 [thread overview]
Message-ID: <20180220084354.GO25235@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180220083937.GX25201@hirez.programming.kicks-ass.net>
On Tue, Feb 20, 2018 at 09:39:37AM +0100, Peter Zijlstra wrote:
> 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));
Oooh shiny, you can actually write:
switch(__builtin_expect(dentry_lock_inode(dentry), LOCK_FAST)) {
and have that work, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59521
> > 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;
> > }
> >
next prev parent reply other threads:[~2018-02-20 13:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 15:09 [PATCH 0/4] fs/dcache: avoid trylock loops John Ogness
2018-02-16 15:09 ` [PATCH 1/4] fs/dcache: Remove stale comment from dentry_kill() John Ogness
2018-02-16 15:09 ` [PATCH 2/4] fs/dcache: Move dentry_kill() below lock_parent() John Ogness
2018-02-16 15:09 ` [PATCH 3/4] fs/dcache: Avoid the try_lock loop in d_delete() John Ogness
2018-02-16 17:10 ` Peter Zijlstra
2018-02-16 17:30 ` Peter Zijlstra
2018-02-22 5:18 ` Al Viro
2018-02-22 8:35 ` John Ogness
2018-02-16 15:09 ` [PATCH 4/4] fs/dcache: Avoid the try_lock loops in dentry_kill() John Ogness
2018-02-16 18:03 ` Linus Torvalds
2018-02-16 22:32 ` John Ogness
2018-02-16 22:42 ` Linus Torvalds
2018-02-16 23:05 ` John Ogness
2018-02-16 23:31 ` Linus Torvalds
2018-02-16 23:49 ` John Ogness
2018-02-17 0:06 ` Linus Torvalds
2018-02-19 23:34 ` John Ogness
2018-02-20 0:42 ` Linus Torvalds
2018-02-20 8:39 ` Peter Zijlstra
2018-02-20 8:43 ` Peter Zijlstra [this message]
2018-02-22 5:29 ` Al Viro
2018-02-22 5:40 ` Al Viro
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=20180220084354.GO25235@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=hch@lst.de \
--cc=hjl.tools@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®