On 21.07.21 г. 21:45, Linus Torvalds wrote: > On Wed, Jul 21, 2021 at 11:17 AM Nikolay Borisov <nborisov@xxxxxxxx> wrote: >> >> I find it somewhat arbitrary that we choose to align the 2nd pointer and >> not the first. > > Yeah, that's a bit odd, but I don't think it matters. > > The hope is obviously that they are mutually aligned, and in that case > it doesn't matter which one you aim to align. > >> So you are saying that the current memcmp could indeed use improvement >> but you don't want it to be based on the glibc's code due to the ugly >> misalignment handling? > > Yeah. I suspect that this (very simple) patch gives you the same > performance improvement that the glibc code does. You suspect correctly, perf profile: 30.44% -29.38% [kernel.vmlinux] [k] memcmp This is only on x86-64 as I don't have other arch handy. But this one is definitely good.