Messages in this thread | | | From | Linus Torvalds <> | Date | Fri, 3 Mar 2023 09:54:00 -0800 | Subject | Re: [PATCH v3 2/2] vfs: avoid duplicating creds in faccessat if possible |
| |
On Fri, Mar 3, 2023 at 9:39 AM Mateusz Guzik <mjguzik@gmail.com> wrote: > > So the key is: memset is underperforming at least on x86-64 for > certain sizes and the init-on-alloc thingy makes it used significantly > more, exacerbating the problem
One reason that the kernel memset isn't as optimized as memcpy, is simply because under normal circumstances it shouldn't be *used* that much outside of page clearing and constant-sized structure initialization.
Page clearing is fine, and constant-sized structure inits are also generally fine (ie the compiler does the small ones directly).
So this is literally a problem with pointless automated memset, introduced by that hardening option. And hardening people generally simply don't care about performance, and the people who _do _care about performance usually don't enable the known-expensive crazy stuff.
Honestly, I think the INIT_ONCE stuff is actively detrimental, and only hides issues (and in this case adds its own). So I can't but help to say "don't do that then". I think it's literally stupid to clear allocations by default.
I'm not opposed to improving memset, but honestly, if the argument is based on the stupid hardening behavior, I really think *that* needs to be fixed first.
Linus
| |