Re: [linus:master] [iov_iter] c9eec08bac: vm-scalability.throughput -16.9% regression

Linus Torvalds
2023-11-15T18:46:18Z

On Wed, 15 Nov 2023 at 13:35, David Howells <dhowells@redhat.com> wrote:
>
> That's not what I see. See attached for a dump of _copy_from_iter from my
> kernel. It's just using REP MOVSB.

Yeah, an unconditional REP MOVSB is not right either. That just means
that it performs truly horrendously badly on some machines.

Do you perhaps have CONFIG_CC_OPTIMIZE_FOR_SIZE set? That makes gcc
use "rep movsb" - even for small copies that most definitely should
*not* use "rep movsb".

Anyway, you should never use CC_OPTIMIZE_FOR_SIZE as any kind of
baseline. I'd actually love to use it in general, but it really makes
gcc do silly things when it goes for size optimizations that make no
sense at all (because it will go for size over anything else).

It turns out that on FSRM machines (ie anything really new), it's ok,
because even small constant-sized copies do work ok with "rep movsb",
but there are cases where it's absolutely horrendously bad.

Linus