Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	 Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	 Brendan Jackman <brendan.jackman@linux.dev>,
	Zi Yan <ziy@nvidia.com>, Chris Li <chrisl@kernel.org>,
	 Kairui Song <kasong@tencent.com>,
	Kemeng Shi <shikemeng@huaweicloud.com>,
	 Nhat Pham <nphamcs@gmail.com>, Baoquan He <baoquan.he@linux.dev>,
	 Barry Song <baohua@kernel.org>,
	Youngjun Park <youngjun.park@lge.com>,
	 Uladzislau Rezki <urezki@gmail.com>,
	Michal Hocko <mhocko@suse.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org
Subject: Re: [PATCH] mm: add some missing includes to mm-local headers
Date: Tue, 4 Aug 2026 12:05:40 +0100	[thread overview]
Message-ID: <anHG7BcQ8EFrwvGm@lucifer> (raw)
In-Reply-To: <7e7c8e04-646f-4135-9ba5-e0c7fd6d8b41@kernel.org>

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


  parent reply	other threads:[~2026-08-04 14:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260804-fix-some-local-headers-v1-1-a7beb173c116@kernel.org>
     [not found] ` <8179be78-a35c-4d0f-8034-27f3154db0e7@kernel.org>
2026-08-04 11:02   ` [PATCH] mm: add some missing includes to mm-local headers Lorenzo Stoakes (ARM)
2026-08-04 12:17     ` David Hildenbrand (Arm)
     [not found]   ` <7e7c8e04-646f-4135-9ba5-e0c7fd6d8b41@kernel.org>
2026-08-04 11:05     ` Lorenzo Stoakes (ARM) [this message]
2026-08-04 11:11       ` David Hildenbrand (Arm)
2026-08-04 20:00 ` Zi Yan
2026-08-04 22:21 ` Barry Song
2026-08-05  2:45 ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anHG7BcQ8EFrwvGm@lucifer \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baoquan.he@linux.dev \
    --cc=brendan.jackman@linux.dev \
    --cc=cgroups@vger.kernel.org \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kasong@tencent.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=osalvador@suse.de \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=shikemeng@huaweicloud.com \
    --cc=surenb@google.com \
    --cc=urezki@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=youngjun.park@lge.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox