From: Borislav Petkov <bp@alien8.de>
To: Hugh Dickins <hughd@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: x86: should clear_user() have alternatives?
Date: Tue, 8 Feb 2022 13:52:32 +0100 [thread overview]
Message-ID: <YgJnhB+bAxoNsiSB@zn.tnic> (raw)
In-Reply-To: <2f5ca5e4-e250-a41c-11fb-a7f4ebc7e1c9@google.com>
Hi Hugh,
On Mon, Feb 07, 2022 at 09:45:36PM -0800, Hugh Dickins wrote:
> I realize that dd'ing from /dev/zero to /dev/null, and sparse files on
> tmpfs, are not prime candidates for optimization; and I've no idea how
> much clear_user() normally gets used for long clears.
Right, we usually don't take such "optimizations" because the folks who
send them always come up with either microbenchmarks or only test on a
single machine.
> If I were capable of compiler asm, with alternatives, and knew at what
> length ERMS becomes advantageous when clearing, I would be sending you
> a proper patch. As it is, I'm hoping to tempt someone else to do the
> work! Or reject it as too niche to bother with.
Yap, looking at arch/x86/lib/clear_page_64.S - that's straight-forward
asm without special-cases noodles like __copy_user_nocache, for example,
so I wouldn't be opposed to someone
- remodelling it so that you can have clear_user* variants there too,
with the length supplied so that you can call a common function with
arbitrary length and clear_page* can call it too. And then call them in
a clear_user() version just like the clear_page() one which selects the
proper target based on CPU feature flags.
- testing this on bunch of modern machines with, say, a kernel build or
some sensible benchmark so that we at least have some coverage
If the numbers are worth it - and judging by your quick testing above
they should be - then I don't mind taking that at all.
If only someone would have the time and diligence to do it properly...
:-)
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2022-02-08 13:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 5:45 x86: should clear_user() have alternatives? Hugh Dickins
2022-02-08 11:45 ` David Laight
2022-02-08 12:52 ` Borislav Petkov [this message]
2022-02-08 23:36 ` David Laight
2022-02-09 6:18 ` Hugh Dickins
2022-04-07 23:21 ` Jason A. Donenfeld
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=YgJnhB+bAxoNsiSB@zn.tnic \
--to=bp@alien8.de \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--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