Re: [PATCH 00/28] Fast kernel headers: reduce header dependencies

From: Max Kellermann
Date: Wed Jan 31 2024 - 17:00:49 EST


On Wed, Jan 31, 2024 at 10:44 PM Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
> How were these (a) missing and (b) unnecessary includes
> found or determined?
> Did you use some tool for that? If so, which one?

No tool, just stgit to edit the patches (in arbitrary order). I
reduced header dependencies, but got lots of build errors because
symbols were missing in different sources, which were previously
fulfilled by indirect includes that were now removed. I fixed all
those build errors by adding missing includes to those headers, moving
those changes to the first patch.

I found the unnecessary includes manually along the way by using "git
grep" to find all include directives for a certain header; I checked
the source for the reason why this header was included, and whether
the include could be replaced with "X_types.h" instead. Sometimes, I
found that not even "X_types.h" was necessary, but no include at all,
so I removed the include completely and had those changes in the
second patch.

The first two patches grew along the way. It was refreshed over and
over (with stgit), while I was editing the other patches.

I know there's the "iwyu" tool, and it may be helpful eventually, but
there's so much low-hanging fruit in the kernel, iwyu is not useful
yet I think.

Max