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

From: Linus Torvalds
Date: Tue Jan 24 2023 - 11:58:57 EST


On Tue, Jan 24, 2023 at 12:54 AM David Laight <David.Laight@xxxxxxxxxx> wrote:
>
> 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.

For some loads, yes.

> You can speed things up by copying all the .h files from the
> fixed -I path list into a single directory.

Or, better yet, do a proper pathname cache that has negative entries
in it too. Like Linux does.

Because it's a common pattern, not just for include paths. You find it
for the regular PATH handling, and for various "look up my config file
in these directories" kind of thing.

So caching not just successful pathname lookups, but the failed ones
too, is actually important.

(Obviously it's still faster to not have to even search at all, and
put everything in one directory and not have a search path at all, but
it does have its own serious downsides, notably the whole "now we have
to keep that union directory in sync with all the source directories")

Linus