Re: [PATCH] x86, mem: move memmove to out of line assembler
From: Linus Torvalds
Date: Fri Sep 23 2022 - 14:09:43 EST
On Fri, Sep 23, 2022 at 10:55 AM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> We could remove __HAVE_ARCH_MEMMOVE from
> arch/x86/include/asm/string_32.h for ARCH=i386 then rip this
> arch-specific definition of memmove out.
>
> Might performance regressions be a concern with that approach?
memmove() isn't particularly common, but it does happen for some paths
that can be hot - the usual case of moving parts of an array around. I
see filesystems and networking paths doing that.
The generic memmove() is a horrendous byte-at-a-time thing and only
good for bring-up of new architectures. That's not an option.
But I'm looking at that x86-64 memcpy_orig, and I think it looks
fairly good as a template for doing the same on x86-32. And we could
get rid of the duplication on the x86-64 side.
That said, your patch looks fine too, as a "minimal changes" thing.
Linus