RE: [PATCH] lib/genalloc: use try_cmpxchg in {set,clear}_bits_ll

From: David Laight
Date: Tue Jan 24 2023 - 03:54:32 EST


From: Mateusz Guzik
> Sent: 24 January 2023 00:11
...
> So if you strace something like gcc compiling stuff you will find:
> - some access calls on shared dirs, for example:
> 78533 access("/usr/lib/gcc/x86_64-linux-gnu/11/", X_OK) = 0
> 78533 access("/usr/lib/gcc/x86_64-linux-gnu/11/", X_OK) = 0
> 78533 access("/usr/lib/gcc/x86_64-linux-gnu/11/", X_OK) = 0

Are they back to back? Which is just stupid.
Once per invocation of gcc would be noise.

> - same with newfstatat:
> 87428 newfstatat(AT_FDCWD, "./arch/x86/include", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
> 87428 newfstatat(AT_FDCWD, "./arch/x86/include/generated", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
> 87428 newfstatat(AT_FDCWD, "./include", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
> 87428 newfstatat(AT_FDCWD, "./arch/x86/include/uapi", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
> - there is also quite a bit of readlink:
> 87502 readlink("/tmp", 0x7ffe28847ac0, 1023) = -1 EINVAL (Invalid argument)
> 87502 readlink("/tmp/ccTh37oI.s", 0x7ffe28847ac0, 1023) = -1 EINVAL (Invalid argument)
>
> that last bit is glibc doing realpath(). A case can be made for making
> realpath into a syscall instead, but I'm not going to flame over for
> the time being. :)

I remember looking at syscall counts during a (NetBSD) build
and deciding that the dominant system call was actually failed
opens from the compiler searching long -I paths looking for
headers.
You can speed things up by copying all the .h files from the
fixed -I path list into a single directory.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)