Re: [PATCH 0/7] minmax: reduce compilation time

Matthew Wilcox
2024-07-27T17:34:00Z

On Fri, Jul 26, 2024 at 09:13:11PM -0700, Linus Torvalds wrote:
> but while that is certainly an impressive 82kB line, we have some good
> company in code VM header files, and I've also seen
>
> Longest line is include/linux/page-flags.h:507 (27kB)
> 'static inline __attribute__((__gnu_inline__))
> __attribute__((__unused__)) __attribute__((no_instrume...'
>
> because the expansion from
>
> __PAGEFLAG(Locked, locked, PF_NO_TAIL)
>
> does indeed generate some impressive stuff. It's all the functions for
> the locked bit handling generated from one line.

In the specific case of PageLocked, that can hopefully go away fairly
soon. We only have 24 instances left in tree and five of those are
comments/docs. The ones in fs (btrfs, crypto, f2fs, ocfs2 and pipe)
should be converted to folio soon.

Mostly they're just detritus. We could probably remove the PageLocked
definition in the next merge window if we actually care.

But I have been wondering whether the way we define all the functions
around page/folio flags is sensible. Every file which includes
page-flags.h (... which is most of them ...) regenerates the macros.
You can't grep for the definition of folio_test_locked(). There's
nowhere to put kernel-doc for folio_test_locked().

Would we be better off generating page-flags-generated.h from a more
compact definition file somewhere, rather than using the C preprocessor?