summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-14 12:39:34 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-14 12:39:34 -0800
commit787fe1d43a21d688afac740f92485e9373d19f01 (patch)
tree4d089d0aba0fae0d90aafc78ea5bb28831e25528
parent8b3c75a39cc3cde78332f0e10898104a5e1e2807 (diff)
parentf56ccc32468ee7885d3a9175e7d2cb608d301521 (diff)
Merge tag 'memblock-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock updates from Mike Rapoport: - update tools/include/linux/mm.h to fix memblock tests compilation - drop redundant struct page* parameter from memblock_free_pages() and get struct page from the pfn - add underflow detection for size calculation in memtest and warn about underflow when VM_DEBUG is enabled * tag 'memblock-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: mm/memtest: add underflow detection for size calculation memblock: drop redundant 'struct page *' argument from memblock_free_pages() memblock test: include <linux/sizes.h> from tools mm.h stub
-rw-r--r--mm/internal.h3
-rw-r--r--mm/memblock.c4
-rw-r--r--mm/memtest.c2
-rw-r--r--mm/mm_init.c5
-rw-r--r--tools/include/linux/mm.h1
-rw-r--r--tools/testing/memblock/internal.h3
6 files changed, 10 insertions, 8 deletions
diff --git a/mm/internal.h b/mm/internal.h
index aee1f72ef6ed..7493d2b2743c 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -809,8 +809,7 @@ static inline void clear_zone_contiguous(struct zone *zone)
extern int __isolate_free_page(struct page *page, unsigned int order);
extern void __putback_isolated_page(struct page *page, unsigned int order,
int mt);
-extern void memblock_free_pages(struct page *page, unsigned long pfn,
- unsigned int order);
+extern void memblock_free_pages(unsigned long pfn, unsigned int order);
extern void __free_pages_core(struct page *page, unsigned int order,
enum meminit_context context);
diff --git a/mm/memblock.c b/mm/memblock.c
index d9ede2cfa98f..b3ddfdec7a80 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1772,7 +1772,7 @@ void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
end = PFN_DOWN(base + size);
for (; cursor < end; cursor++) {
- memblock_free_pages(pfn_to_page(cursor), cursor, 0);
+ memblock_free_pages(cursor, 0);
totalram_pages_inc();
}
}
@@ -2217,7 +2217,7 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end)
while (start + (1UL << order) > end)
order--;
- memblock_free_pages(pfn_to_page(start), start, order);
+ memblock_free_pages(start, order);
start += (1UL << order);
}
diff --git a/mm/memtest.c b/mm/memtest.c
index c2c609c39119..520d41534cfa 100644
--- a/mm/memtest.c
+++ b/mm/memtest.c
@@ -50,6 +50,8 @@ static void __init memtest(u64 pattern, phys_addr_t start_phys, phys_addr_t size
start_bad = 0;
last_bad = 0;
+ VM_WARN_ON_ONCE(size < start_phys_aligned - start_phys);
+
for (p = start; p < end; p++)
WRITE_ONCE(*p, pattern);
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 1a29a719af58..61d983d23f55 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -2474,9 +2474,10 @@ void *__init alloc_large_system_hash(const char *tablename,
return table;
}
-void __init memblock_free_pages(struct page *page, unsigned long pfn,
- unsigned int order)
+void __init memblock_free_pages(unsigned long pfn, unsigned int order)
{
+ struct page *page = pfn_to_page(pfn);
+
if (IS_ENABLED(CONFIG_DEFERRED_STRUCT_PAGE_INIT)) {
int nid = early_pfn_to_nid(pfn);
diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h
index 677c37e4a18c..028f3faf46e7 100644
--- a/tools/include/linux/mm.h
+++ b/tools/include/linux/mm.h
@@ -4,6 +4,7 @@
#include <linux/align.h>
#include <linux/mmzone.h>
+#include <linux/sizes.h>
#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
diff --git a/tools/testing/memblock/internal.h b/tools/testing/memblock/internal.h
index 0ab4b53bb4f3..009b97bbdd22 100644
--- a/tools/testing/memblock/internal.h
+++ b/tools/testing/memblock/internal.h
@@ -15,8 +15,7 @@ bool mirrored_kernelcore = false;
struct page {};
-void memblock_free_pages(struct page *page, unsigned long pfn,
- unsigned int order)
+void memblock_free_pages(unsigned long pfn, unsigned int order)
{
}