[PATCH v2 1/3] mm: split out mm_init and memblock declarations from internal.h
Mike Rapoport
rppt at kernel.org
Sat Jul 11 08:14:28 PDT 2026
On Thu, Jul 09, 2026 at 01:00:03PM +0300, Mike Rapoport (Microsoft) wrote:
> mm/internal.h becomes more and more bloated.
>
> Move declarations for related to mm/mm_init.c and mm/memblock.c to a new
> mm/mm_init.h header.
>
> No functional changes.
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt at kernel.org>
> Acked-by: Muchun Song <muchun.song at linux.dev>
> ---
> MAINTAINERS | 1 +
> kernel/liveupdate/kexec_handover.c | 1 +
> mm/cma.c | 1 +
> mm/hugetlb.c | 1 +
> mm/internal.h | 91 ----------------------------
> mm/memblock.c | 1 +
> mm/memory_hotplug.c | 1 +
> mm/mm_init.c | 1 +
> mm/mm_init.h | 120 +++++++++++++++++++++++++++++++++++++
> mm/page_alloc.c | 1 +
> mm/sparse-vmemmap.c | 1 +
> mm/sparse.c | 1 +
> 12 files changed, 130 insertions(+), 91 deletions(-)
As always I forgot to update the memblock tests :(
Andrew, can you please merge this as a fixup:
>From 4724f0868aa5ab6bc1c054d0be1cca2067533c22 Mon Sep 17 00:00:00 2001
From: "Mike Rapoport (Microsoft)" <rppt at kernel.org>
Date: Sat, 11 Jul 2026 18:11:13 +0300
Subject: [PATCH] memblock tests: split stubfs from internal.h to mm_init.h
Following the split of declarations from mm/internal.h to mm/mm_init.h
update memblock tests to match the kernel core, otherwise they fail to
build.
Signed-off-by: Mike Rapoport (Microsoft) <rppt at kernel.org>
---
tools/testing/memblock/internal.h | 20 --------------------
tools/testing/memblock/mm_init.h | 24 ++++++++++++++++++++++++
2 files changed, 24 insertions(+), 20 deletions(-)
create mode 100644 tools/testing/memblock/mm_init.h
diff --git a/tools/testing/memblock/internal.h b/tools/testing/memblock/internal.h
index b6b1d147fd75..4168e646af09 100644
--- a/tools/testing/memblock/internal.h
+++ b/tools/testing/memblock/internal.h
@@ -28,22 +28,6 @@ static inline struct page *virt_to_page(void *virt)
return virt;
}
-void memblock_free_pages(unsigned long pfn, unsigned int order)
-{
-}
-
-static inline void accept_memory(phys_addr_t start, unsigned long size)
-{
-}
-
-unsigned long free_reserved_area(void *start, void *end, int poison, const char *s);
-void free_reserved_page(struct page *page);
-
-static inline bool deferred_pages_enabled(void)
-{
- return false;
-}
-
#define for_each_valid_pfn(pfn, start_pfn, end_pfn) \
for ((pfn) = (start_pfn); (pfn) < (end_pfn); (pfn)++)
@@ -60,10 +44,6 @@ static inline bool __is_kernel(unsigned long addr)
#define for_each_valid_pfn(pfn, start_pfn, end_pfn) \
for ((pfn) = (start_pfn); (pfn) < (end_pfn); (pfn)++)
-static inline void init_deferred_page(unsigned long pfn, int nid)
-{
-}
-
#define __SetPageReserved(p) ((void)(p))
#endif
diff --git a/tools/testing/memblock/mm_init.h b/tools/testing/memblock/mm_init.h
new file mode 100644
index 000000000000..95bc5f2e8ed8
--- /dev/null
+++ b/tools/testing/memblock/mm_init.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef __MM_MM_INIT_H
+#define __MM_MM_INIT_H
+
+void memblock_free_pages(unsigned long pfn, unsigned int order)
+{
+}
+
+static inline void accept_memory(phys_addr_t start, unsigned long size)
+{
+}
+
+unsigned long free_reserved_area(void *start, void *end, int poison, const char *s);
+void free_reserved_page(struct page *page);
+
+static inline bool deferred_pages_enabled(void)
+{
+ return false;
+}
+
+static inline void init_deferred_page(unsigned long pfn, int nid)
+{
+}
+#endif /* __MM_MM_INIT_H */
--
2.53.0
--
Sincerely yours,
Mike.
More information about the kexec
mailing list