On 9/3/23, Mateusz Guzik <mjguzik@xxxxxxxxx> wrote: > On Sun, Sep 03, 2023 at 01:08:03PM -0700, Linus Torvalds wrote: >> On Sun, 3 Sept 2023 at 11:49, Linus Torvalds >> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: >> > >> > So I have no idea why you claim that "currently they have no choice". >> > glibc is simply being incredibly stupid, and using newfstatat() for no >> > good reason. >> >> Do you have any good benchmark that shows the effects of this? >> >> And if you do, does the attached patch (ENTIRELY UNTESTED!) fix the >> silly glibc mis-feature? >> > > "real fstat" is syscall(5, fd, &sb). > > Sapphire Rapids, will-it-scale, ops/s > > stock fstat 5088199 > patched fstat 7625244 (+49%) > real fstat 8540383 (+67% / +12%) > > It dodges lockref et al, but it does not dodge SMAP which accounts for > the difference. > I'm going to ask glibc people what's up with the change later. I'll note statx does not have a dedicated entry point (I checked again ;)) which elides path lookup. It *did* have a way, but it got removed in 1e2f82d1e9d1 ("statx: Kill fd-with-NULL-path support in favour of AT_EMPTY_PATH"). One frequent consumer I know of is Rust. Would be nice to have a non-hacky way to sort it out. -- Mateusz Guzik <mjguzik gmail.com>