Re: [PATCH] mm: add some missing includes to mm-local headers
From: Lorenzo Stoakes (ARM)
Date: Tue Aug 04 2026 - 07:20:32 EST
On Tue, Aug 04, 2026 at 12:51:40PM +0200, David Hildenbrand (Arm) wrote:
> On 8/4/26 12:45, David Hildenbrand (Arm) wrote:
> > On 8/4/26 12:08, Lorenzo Stoakes (ARM) wrote:
> >> There are a number of internal headers local to mm/ which reference
> >> functions and data types without including the relevant headers.
> >>
> >> mm/vma.h is a special case that intentionally does not include additional
> >> headers, but the others are not.
> >>
> >> This breaks tooling like clangd (which is where I noticed this), though the
> >> build is OK due to the C files including the headers happening to include
> >> required dependencies.
> >>
> >> It's better to be explicit about dependencies anyway, so add the missing
> >> includes and fix clangd as a bonus.
> >
> > I'm curious, how did you identify these? The mm/vmalloc.h is rather easy, but I wonder about
> > e.g., mm/shuffle.h including mmzone.h.
> >
>
> To clarify, I have clangd running behind a vim plugin, and so far it just worked.
>
> I had to generate a weird XML at some point that does magical things for clangd.
Well for me I get the kernel build to generate compiler_commands.json and use
that via:
scripts/clang-tools/gen_compile_commands.py vmlinux.a arch/x86/boot/
In a build script.
But maybe I need your weird XML... I do get frustrated that it limits things to
what I happened to compile. It'd be nice to get it to index literally everything
somehow.
>
> So I'm curious how to invoke clangd manually to actually get these reports.
See other reply, it's just that I noticed missing symbols.
Actually this happened with vma.h (I sloppily got AI to figure out any other
cases) which _intentionally_ doesn't have includes.
But clangd lets you work around that in .clangd:
If:
PathMatch: mm/vma\.h
CompileFlags:
Add: [-include, mm/vma_internal.h]
:)
>
> --
> Cheers,
>
> David
--
Cheers, Lorenzo