From: David Laight <david.laight.linux@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>,
Usama Arif <usama.arif@linux.dev>,
dave.hansen@linux.intel.com, dsterba@suse.com,
linux-kernel@vger.kernel.org, mingo@redhat.com, terrelln@fb.com,
tglx@kernel.org, x86@kernel.org, kas@kernel.org,
hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev,
kernel-team@meta.com
Subject: Re: [PATCH v3 2/2] x86/lib: Use REP MOVSB for large memcpy() on ERMS CPUs without FSRM
Date: Sun, 15 Nov 2026 23:01:08 +0000 [thread overview]
Message-ID: <20261115230108.44309d35@pumpkin> (raw)
In-Reply-To: <CAHk-=wjNdNjA_=POY-jA2ot+KKTVJ1-b7Xv_bwF6ehF-AJMmQQ@mail.gmail.com>
On Sun, 15 Nov 2026 10:45:22 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Sun, 15 Nov 2026 at 04:42, David Laight <david.laight.linux@gmail.com> wrote:
> >
> > > But having extra registers free could help at the call-site,
> >
> > There isn't much you can put at the call site instead of a 5 byte call.
>
> You misunderstand.
>
> Avoiding call-clobbered registers means that the caller has more
> registers live and can do better code generation.
I missed that was what you were thinking of.
Clearly you definitely want as few registers clobbered as possible.
It is a compromise, but current 'standard C calling convention
is horrid here'.
> Making the calling convention clobber registers that aren't useful is
> *bad*. And if you do a loop - which you know is either large or
> unknown size - and take the I$ hit, adding a couple of push/pop
> instructions really doesn't hurt AT ALL.
When I get around to some memcpy() performance measurements I'll
include it.
> It has nothing to do with the 5-byte "'call' or 'rep movsb'" instruction.
>
> (And I realize that 'rep movsb' is only two bytes. You'd add a 3-byte
> nop or harmless prefixes to it depending on which decodes better)
I'm not sure why I mentioned a two byte nop, I've been writing x86 asm
since 1982 and really should get it right.
David
>
> Linus
>
next prev parent reply other threads:[~2026-11-15 23:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 13:20 [PATCH v3 0/2] " Usama Arif
2026-11-11 13:20 ` [PATCH v3 1/2] x86/lib: Keep the scalar memcpy() count in RCX Usama Arif
2026-11-11 13:20 ` [PATCH v3 2/2] x86/lib: Use REP MOVSB for large memcpy() on ERMS CPUs without FSRM Usama Arif
2026-11-11 13:56 ` Peter Zijlstra
2026-11-11 23:46 ` Borislav Petkov
2026-11-12 9:37 ` David Laight
2026-11-13 14:31 ` Usama Arif
2026-11-13 14:11 ` Usama Arif
2026-11-13 16:03 ` David Laight
2026-11-13 17:34 ` Linus Torvalds
2026-11-13 18:36 ` H. Peter Anvin
2026-11-13 23:37 ` Borislav Petkov
2026-11-14 2:21 ` H. Peter Anvin
2026-11-14 22:45 ` David Laight
2026-11-15 0:56 ` Linus Torvalds
2026-11-15 12:42 ` David Laight
2026-11-15 18:45 ` Linus Torvalds
2026-11-15 23:01 ` David Laight [this message]
2026-11-13 19:42 ` David Laight
2026-11-11 18:19 ` [PATCH v3 0/2] " Kiryl Shutsemau
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=20261115230108.44309d35@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dsterba@suse.com \
--cc=hannes@cmpxchg.org \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=riel@surriel.com \
--cc=shakeel.butt@linux.dev \
--cc=terrelln@fb.com \
--cc=tglx@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=usama.arif@linux.dev \
--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
all inboxes | Powered by JetHome®