From: "Arnd Bergmann" <arnd@arndb.de>
To: "Linus Torvalds" <torvalds@linux-foundation.org>,
"Christian Brauner" <brauner@kernel.org>,
"Alexander Viro" <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
"the arch/x86 maintainers" <x86@kernel.org>,
"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Alexei Starovoitov" <ast@kernel.org>
Subject: Re: FYI: path walking optimizations pending for 6.11
Date: Thu, 20 Jun 2024 09:53:20 +0200 [thread overview]
Message-ID: <90b46873-f60f-4ece-bef6-b8eed3b68ac1@app.fastmail.com> (raw)
In-Reply-To: <CAHk-=whHvMbfL2ov1MRbT9QfebO2d6-xXi1ynznCCi-k_m6Q0w@mail.gmail.com>
On Wed, Jun 19, 2024, at 22:25, Linus Torvalds wrote:
> The arm64-uaccess branch is just what it says, and makes a big
> difference in strncpy_from_user(). The "access_ok()" change is
> certainly debatable, but I think needs to be done for sanity. I think
> it's one of those "let's do it, and if it causes problems we'll have
> to fix things up" things.
I'm a bit worried about the access_ok() being so different from
the other architectures, after I previously saw all the ways
it could go wrong because of subtle differences.
I don't mind making the bit that makes the untagging
unconditional, and I can see how this improves code
generation. I've tried comparing your version against
the more conventional
static inline int access_ok(const void __user *p, unsigned long size)
{
return likely(__access_ok(untagged_addr(p), size));
}
Using gcc-13.2, I see your version is likely better in all
cases, but not by much: for the constant-length case, it
saves only one instruction (combining the untagging with the
limit), while for a variable length it avoids a branch.
On a 24MB kernel image, I see this add up to a size difference
of 12KB, while the total savings from avoiding the conditional
untagging are 76KB.
Do you see a measurable performance difference between your
version and the one above?
On a related note, I see that there is one caller of
__access_ok() in common code, and this was added in
d319f344561d ("mm: Fix copy_from_user_nofault().").
I think that one should just go back to using access_ok()
after your 6ccdc91d6af9 ("x86: mm: remove
architecture-specific 'access_ok()' define"). In the
current version, it otherwise misses the untagging
on arm64.
Arnd
next prev parent reply other threads:[~2024-06-20 7:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 20:25 FYI: path walking optimizations pending for 6.11 Linus Torvalds
2024-06-19 20:45 ` Matthew Wilcox
2024-06-19 22:08 ` Linus Torvalds
2024-06-20 18:53 ` Kent Overstreet
2024-06-21 20:04 ` Matthew Wilcox
2024-06-21 20:53 ` Linus Torvalds
2024-06-20 7:53 ` Arnd Bergmann [this message]
2024-06-20 17:25 ` Linus Torvalds
2024-07-09 10:04 ` Mark Rutland
2024-07-09 14:28 ` Linus Torvalds
2024-07-09 16:24 ` Linus Torvalds
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=90b46873-f60f-4ece-bef6-b8eed3b68ac1@app.fastmail.com \
--to=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=brauner@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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