All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <baoquan.he@linux.dev>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@kernel.org>,
	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>, 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: Wed, 5 Aug 2026 10:45:46 +0800	[thread overview]
Message-ID: <anKj2u9jT0WwNO8N@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20260804-fix-some-local-headers-v1-1-a7beb173c116@kernel.org>

On 08/04/26 at 11:08am, 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.
> 
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
>  mm/cma.h           | 1 +
>  mm/hugetlb_cma.h   | 2 ++
>  mm/memcontrol-v1.h | 1 +
>  mm/pgalloc-track.h | 3 +++
>  mm/shuffle.h       | 2 ++
>  mm/swap.h          | 1 +
>  mm/vmalloc.h       | 2 ++
>  7 files changed, 12 insertions(+)

Reviewed-by: Baoquan He <baoquan.he@linux.dev>

> 
> diff --git a/mm/cma.h b/mm/cma.h
> index c70180c36559..ab6d39898ea5 100644
> --- a/mm/cma.h
> +++ b/mm/cma.h
> @@ -2,6 +2,7 @@
>  #ifndef __MM_CMA_H__
>  #define __MM_CMA_H__
>  
> +#include <linux/cma.h>
>  #include <linux/debugfs.h>
>  #include <linux/kobject.h>
>  
> diff --git a/mm/hugetlb_cma.h b/mm/hugetlb_cma.h
> index 3aa483573d17..730b2b4965b6 100644
> --- a/mm/hugetlb_cma.h
> +++ b/mm/hugetlb_cma.h
> @@ -2,6 +2,8 @@
>  #ifndef _LINUX_HUGETLB_CMA_H
>  #define _LINUX_HUGETLB_CMA_H
>  
> +#include <linux/hugetlb.h>
> +
>  #ifdef CONFIG_CMA
>  void hugetlb_cma_free_frozen_folio(struct folio *folio);
>  struct folio *hugetlb_cma_alloc_frozen_folio(int order, gfp_t gfp_mask,
> diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h
> index 0f703f239c80..1e394269c613 100644
> --- a/mm/memcontrol-v1.h
> +++ b/mm/memcontrol-v1.h
> @@ -4,6 +4,7 @@
>  #define __MM_MEMCONTROL_V1_H
>  
>  #include <linux/cgroup-defs.h>
> +#include <linux/memcontrol.h>
>  
>  /* Cgroup v1 and v2 common declarations */
>  
> diff --git a/mm/pgalloc-track.h b/mm/pgalloc-track.h
> index e9e879de8649..1a6de1358a21 100644
> --- a/mm/pgalloc-track.h
> +++ b/mm/pgalloc-track.h
> @@ -2,6 +2,9 @@
>  #ifndef _LINUX_PGALLOC_TRACK_H
>  #define _LINUX_PGALLOC_TRACK_H
>  
> +#include <linux/mm.h>
> +#include <linux/pgtable.h>
> +
>  #if defined(CONFIG_MMU)
>  static inline p4d_t *p4d_alloc_track(struct mm_struct *mm, pgd_t *pgd,
>  				     unsigned long address,
> diff --git a/mm/shuffle.h b/mm/shuffle.h
> index 61bbcddeeee6..11bec7521ab8 100644
> --- a/mm/shuffle.h
> +++ b/mm/shuffle.h
> @@ -2,7 +2,9 @@
>  // Copyright(c) 2018 Intel Corporation. All rights reserved.
>  #ifndef _MM_SHUFFLE_H
>  #define _MM_SHUFFLE_H
> +
>  #include <linux/jump_label.h>
> +#include <linux/mmzone.h>
>  
>  #define SHUFFLE_ORDER MAX_PAGE_ORDER
>  
> diff --git a/mm/swap.h b/mm/swap.h
> index d077e5893a42..ec580c713204 100644
> --- a/mm/swap.h
> +++ b/mm/swap.h
> @@ -5,6 +5,7 @@
>  #include <linux/atomic.h> /* for atomic_long_t */
>  #include <linux/mm.h> /* for PAGE_SHIFT */
>  #include <linux/memcontrol.h> /* for mem_cgroup_swappiness() */
> +#include <linux/swap.h> /* for MAX_SWAPFILES_SHIFT, struct swap_info_struct */
>  
>  struct mempolicy;
>  struct swap_iocb;
> diff --git a/mm/vmalloc.h b/mm/vmalloc.h
> index dcfe30eaa80c..8866ddcff668 100644
> --- a/mm/vmalloc.h
> +++ b/mm/vmalloc.h
> @@ -5,6 +5,8 @@
>  #ifndef __MM_VMALLOC_H
>  #define __MM_VMALLOC_H
>  
> +#include <linux/vmalloc.h>
> +
>  #ifdef CONFIG_MMU
>  void __init vmalloc_init(void);
>  int __must_check vmap_pages_range_noflush(unsigned long addr, unsigned long end,
> 
> ---
> base-commit: e47602c51d20a93fa1711ed896dc9480de4374d9
> change-id: 20260804-fix-some-local-headers-0ebc15f34c72
> 
> Cheers,
> -- 
> Lorenzo Stoakes (ARM) <ljs@kernel.org>
> 


      parent reply	other threads:[~2026-08-05  2:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 10:08 [PATCH] mm: add some missing includes to mm-local headers Lorenzo Stoakes (ARM)
2026-08-04 10:44 ` Vlastimil Babka (SUSE)
2026-08-04 10:45 ` David Hildenbrand (Arm)
2026-08-04 10:51   ` David Hildenbrand (Arm)
2026-08-04 11:05     ` Lorenzo Stoakes (ARM)
2026-08-04 11:11       ` David Hildenbrand (Arm)
2026-08-04 11:02   ` Lorenzo Stoakes (ARM)
2026-08-04 12:17     ` David Hildenbrand (Arm)
2026-08-04 20:00 ` Zi Yan
2026-08-04 22:21 ` Barry Song
2026-08-05  2:45 ` Baoquan He [this message]

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=anKj2u9jT0WwNO8N@MiWiFi-R3L-srv \
    --to=baoquan.he@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --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=ljs@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.