[lkml]   [2018]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [GIT PULL] pin control bulk changes for v4.16
On Mon, Feb 5, 2018 at 2:09 AM, David Laight <> wrote:
> From: Linus Torvalds
>> Sent: 02 February 2018 22:57
> ...
>> I also wonder if there are any automated tools that try to find these
>> kinds of crazy things. I suspect a lot of our build times is the poor
>> compiler just reading and parsing header files over and over again,
>> and a lot of them are probably not needed.
> I've counted system calls during a NetBSD kernel build, I imagine Linux is
> much the same.
> Most of the calls were open(), and most of those failing opens.
> I suspected that most came from searching the -I path to find headers.
> Build over NFS and the cost is even more significant (every directory
> name in the path (used to) require an NFS message exchange).

I suspect that Linux is actually very _different_ in this area,
because Linux has a very extensive name cache for pathname lookup that
also captures negative path component entries.

End result: opening a file - whether it exists or not - doesn't
actually go down to the filesystem at all when things are cached. My
kernel profiles also show that very clearly, there's absolutely no
filesystem component to the build at all (but there is a noticeable
VFS component to it, and __d_lookup_rcu is generally one of the
hottest kernel functions along with the system call entry/exit code).

Now, on NFS the caching will be a bit less effective because we have a
timeout that forces re-validation of the caches, but even there at
least the "look up the same header pathname" will be captured very
well. So the most common case - of doing the include path lookup for
all those really core header files that _everbody_ ends up including -
ends up being captured pretty much 100% in the caches even on NFS. On
a local filesystem, as long as you have enough RAM, those lookups will
be cached even across multiple kernel compiles.

At least if you are like me, and all you do all day long is build the kernel ;)


 \ /
  Last update: 2018-02-05 17:55    [W:0.085 / U:5.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site