From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Jeff Layton <jlayton@kernel.org>,
Ilya Dryomov <idryomov@gmail.com>,
ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
clang-built-linux <llvm@lists.linux.dev>
Subject: Re: [GIT PULL] Ceph updates for 5.20-rc1
Date: Sun, 14 Aug 2022 20:08:29 +0100 [thread overview]
Message-ID: <YvlILbn1ERLgZreh@ZenIV> (raw)
In-Reply-To: <CAHk-=wjyOB66pofW0mfzDN7SO8zS1EMRZuR-_2aHeO+7kuSrAg@mail.gmail.com>
On Thu, Aug 11, 2022 at 08:58:54PM -0700, Linus Torvalds wrote:
> On Thu, Aug 11, 2022 at 3:43 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > Oh, sadly, clang does much worse here.
> >
> > Gcc ends up being able to not have a stack frame at all for
> > __d_lookup_rcu() once that DCACHE_OP_COMPARE case has been moved out.
> > The gcc code really looks very nice.
> >
> > Clang, not so much, and it still has spills and reloads.
>
> I ended up looking at the clang code generation more than I probably
> should have, because I found it so odd.
>
> Our code is literally written to not need that many values, and it
> should be easy to keep everything in registers.
>
> It turns out that clang is trying much too hard to be clever in
> dentry_string_cmp(). The code is literally written so that we keep the
> count of remaining characters in 'tcount', and then at the end we can
> generate a 'mask' from that to ignore the parts of the pathname that
> are beyond the size.
[snip]
There's a cheap way to reduce the register pressure:
seq = raw_seqcount_begin(&dentry->d_seq);
if (dentry->d_parent != parent)
continue;
if (d_unhashed(dentry))
continue;
if (dentry->d_name.hash_len != hashlen)
continue;
if (dentry_cmp(dentry, str, hashlen_len(hashlen)) != 0)
continue;
*seqp = seq;
could move the last store to before dentry_cmp(). Sure, we might get
some extra stores out of that. Into a hot cacheline, and if we really
hit many of those extra stores, we already have a problem - a lot of
collisions both in ->d_parent and ->d_name.hash_len. If that happens,
the cost of those extra stores is going to be trivial noise.
From correctness POV that should be fine; callers of __d_lookup_rcu()
getting NULL either entirely ignore *seqp (d_alloc_parallel()) or
proceed to wipe it out (lookup_fast(), by calling try_to_unlazy()).
Comments?
next prev parent reply other threads:[~2022-08-14 19:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 15:24 [GIT PULL] Ceph updates for 5.20-rc1 Ilya Dryomov
2022-08-11 20:03 ` Linus Torvalds
2022-08-11 20:55 ` Ilya Dryomov
2022-08-11 21:08 ` Jeff Layton
2022-08-11 21:22 ` Al Viro
2022-08-11 21:23 ` Al Viro
2022-08-11 21:30 ` Jeff Layton
2022-08-11 21:38 ` Al Viro
2022-08-11 21:52 ` Linus Torvalds
2022-08-11 22:04 ` Al Viro
2022-08-11 22:22 ` Linus Torvalds
2022-08-11 22:43 ` Linus Torvalds
2022-08-12 3:58 ` Linus Torvalds
2022-08-14 19:08 ` Al Viro [this message]
2022-08-14 20:03 ` Linus Torvalds
2022-08-14 20:29 ` Linus Torvalds
2022-08-14 21:20 ` Nick Desaulniers
2022-08-11 22:44 ` Al Viro
2022-08-11 21:29 ` Linus Torvalds
2022-08-11 21:32 ` pr-tracker-bot
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=YvlILbn1ERLgZreh@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.