From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Anvin <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Al Viro <viro@zeniv.linux.org.uk>,
the arch/x86 maintainers <x86@kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] speeding up the stat() family of system calls...
Date: Tue, 24 Dec 2013 21:46:25 +0100 [thread overview]
Message-ID: <20131224204625.GB20471@gmail.com> (raw)
In-Reply-To: <CA+55aFxZ2u+M72u3HSD7TVY2+WRRi27pYC=_4Wawr5y1m8DfnQ@mail.gmail.com>
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> Here's both x86 people and filesystem people involved, because this
> hacky RFC patch touches both.
>
> NOTE NOTE NOTE! I've modified "cp_new_stat()" in place, in a way that
> is x86-64 specific. So the attached patch *only* works on x86-64, and
> will very actively break on anything else. That's intentional, because
> that way it's more obvious how the code changes, but a real patch
> would create a *new* cp_new_stat() for x86-64, and conditionalize the
> existing generic "cp_new_stat()" on not already having an
> architecture-optimized one.
>
> Basically, under some filesystem loads, "stat()" and friends are the
> most common ops (think tree traversal, but also things like git
> verifying the index). And our "cp_new_stat()" function (which is the
> common interface, ignoring 32-bit legacy stuff) is generic, but
> actually pretty disgusting. It copies things to a temporary 'struct
> stat' buffer on the kernel stack, and then uses copy_to_user() to copy
> it to user space. The double copy is quite noticeable in profiles, and
> it generates a big stack frame too.
>
> By doing an architecture-specific cp_new_stat() function, we can
> improve on that.
>
> HOWEVER. On x86, doing an efficient field-at-a-time copy also requires
> us to use put_user_try() and put_user_catch() in order to not have
> tons of clac/stac instructions for the extended permission testing.
> And the implementation of that was actually fairly non-optimal, so to
> actually get the code I wanted, I had to change how that all worked
> too, using "asm_volatile_goto()".
>
> Thus both x86 and FS people on the list.
>
> Comments? This would obviously be a 3.14 issue, I'm not suggesting
> we'd do this now. I just want to lay the ground-work..
>
> It's tested in the sense that "it works for me", and profiles look
> nice, but..
Looks cool - it looks rather similar to the try/catch model Richard
Henderson came up with many eons ago when we implemented the original
exception mechanism for Linux, which IIRC we decided wasn't safe due
to lack of compiler support.
Now we have compiler support ... written by Richard Henderson ;-)
Thanks,
Ingo
next prev parent reply other threads:[~2013-12-24 20:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-21 20:27 [RFC] speeding up the stat() family of system calls Linus Torvalds
2013-12-21 22:54 ` John Stoffel
2013-12-22 0:11 ` Linus Torvalds
2013-12-24 0:00 ` H. Peter Anvin
2013-12-24 0:12 ` Linus Torvalds
2013-12-24 6:00 ` H. Peter Anvin
2013-12-24 20:46 ` Ingo Molnar [this message]
2013-12-26 19:00 ` Linus Torvalds
2013-12-27 0:45 ` H. Peter Anvin
2013-12-27 3:18 ` H. Peter Anvin
2013-12-27 6:09 ` H. Peter Anvin
2013-12-27 23:30 ` H. Peter Anvin
2014-01-12 17:46 ` Ingo Molnar
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=20131224204625.GB20471@gmail.com \
--to=mingo@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).