Re: [PATCH v4 4/7] kernel.h: Split out min()/max() et al helpers
From: Rasmus Villemoes
Date: Thu Apr 23 2020 - 05:34:01 EST
On 22/04/2020 16.52, Joe Perches wrote:
> On Wed, 2020-04-22 at 15:51 +0300, Andy Shevchenko wrote:
>> At the same time convert users in header and lib folder to use new header.
>> Though for time being include new header back to kernel.h to avoid twisted
>> indirected includes for existing users.
>
> Yeah, that's the difficult bit and it could make
> using precompiled headers very cumbersome.
You mentioned precompiled headers last time as well, but you haven't
demonstrated that using those is either feasible or advantageous - and
if at some distant future time it turns out that they are a good idea,
it's not really any more difficult at that time to do a
linux/kitchen_sink.h that includes whatever common set of headers seems
to provide a reasonable speedup.
Meanwhile, the sheer size of the headers that gets pulled into each and
every TU currently slows down the build:
https://wildmoose.dk/header-bloat/
so anything that reduces the size of common headers like kernel.h will
improve build times (the slowdown is "death by a thousand cuts", hence
so will any individual improvement be hard or impossible to measure by
itself - that doesn't mean it's not worth doing them). Of course, the
include of minmax.h (et al) from kernel.h must be removed, but that's
the kind of thing that can easily take a couple of cycles to get done,
unlike the damage that adding #include <linux/foo.h> to bar.h
immediately causes.
> I'd rather make #include <linux/kernel.h>" _more_
> common or even used as the mandatory first #include
> for all kernel .c files.
No. Please no.
> That would also ensure that common kernel facilities
> are not duplicated or have naming conflicts with other
> files.
What? People duplicate functionality because they're not aware it
already exists, forcing an #include of a declaration of some function
doesn't make any developer know about it.
Rasmus