From: Dave Hansen <dave.hansen@intel.com>
To: david.laight.linux@gmail.com,
Andrew Morton <akpm@linux-foundation.org>,
Andy Shevchenko <andy@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Uros Bizjak <ubizjak@gmail.com>,
linux-kernel@vger.kernel.org, Kees Cook <kees@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH next] i386: Remove string functions that use 'rep scasb'
Date: Mon, 30 Mar 2026 09:58:35 -0700 [thread overview]
Message-ID: <2f763ca6-794e-4b5a-9b92-9a9cc8858cd2@intel.com> (raw)
In-Reply-To: <20260327195747.89556-1-david.laight.linux@gmail.com>
On 3/27/26 12:57, david.laight.linux@gmail.com wrote:
> The fixed overhead of all the 'rep xxx' instructions is rather more
> that might expect. While 'rep movs' is getting better on more recent
> CPU, the same is not true for 'rep scasb'. On my Zen-5 it has a
> fixed overhead of 150 clocks and then takes 3 clocks for each byte.
> I've not measured any Intel CPU, but the cost might be 'only' 40 +
> 2n.
One measurement on a modern 64-bit CPU isn't super convincing to me.
> Remove the asm versions of strcat() strncat() strlen() memchr()
> and memscan(), the generic C versions will be faster.
>
> It is quite likely that all these functions are slower than the generic
> code on pretty much all CPU since the 486.
This is rather handwavy for my taste.
There seem to be two valid paths here:
1. We continue the "nobody cares about 32-bit" refrain. This removes a
bunch of 32-bit-only code and complexity. If it causes a performance
regression, we do not care much.
2. Someone makes _some_ kind of effort to test this on at least *one*
32-bit-only CPU to see if it does any harm.
In other words, I'm not opposed to the patch, but the justification
doesn't really work for me as written.
next prev parent reply other threads:[~2026-03-30 16:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 19:57 david.laight.linux
2026-03-30 16:58 ` Dave Hansen [this message]
2026-03-30 17:21 ` Andy Shevchenko
2026-03-30 19:20 ` David Laight
2026-03-30 19:47 ` Dave Hansen
2026-03-31 0:27 ` Maciej W. Rozycki
2026-03-31 6:59 ` Andy Shevchenko
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=2f763ca6-794e-4b5a-9b92-9a9cc8858cd2@intel.com \
--to=dave.hansen@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andy@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david.laight.linux@gmail.com \
--cc=hpa@zytor.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=ubizjak@gmail.com \
--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
Powered by JetHome