Skip to contentSkip to conversation

memblock test: include <linux/sizes.h> from tools mm.h stub

PATCH In review Mike Rapoport 2 participants 2 messages Dec 28, 2025 – Jan 5 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memblock test: include <linux/sizes.h> from tools mm.h stub

From: "Mike Rapoport (Microsoft)" <[email protected]>

memblock test compilation fails:

memblock.c: In function ‘memblock_validate_numa_coverage’:
memblock.c:784:58: error: ‘SZ_1M’ undeclared (first use in this function)
784 | mem_size_mb = memblock_phys_mem_size() / SZ_1M;
| ^~~~~

The SZ_1M is defined in sizes.h, but it is not included by stub version of mm.h in tools/include/linux.

Add include of sizes.h to tools/include/linux/mm.h to fix the compilation of memblock tests.

---
 tools/include/linux/mm.h | 1 +
 1 file changed, 1 insertion(+)
tools/include/linux/mm.h +1 -0
index 677c37e4a18c..028f3faf46e7 100644
@@ -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)
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Mike Rapoport

From: "Mike Rapoport (Microsoft)" <[email protected]>

memblock test compilation fails:

memblock.c: In function ‘memblock_validate_numa_coverage’:
memblock.c:784:58: error: ‘SZ_1M’ undeclared (first use in this function)
784 | mem_size_mb = memblock_phys_mem_size() / SZ_1M;
| ^~~~~

The SZ_1M is defined in sizes.h, but it is not included by stub version of mm.h in tools/include/linux.

Add include of sizes.h to tools/include/linux/mm.h to fix the compilation of memblock tests.

---
 tools/include/linux/mm.h | 1 +
 1 file changed, 1 insertion(+)
tools/include/linux/mm.h +0 -0
index 677c37e4a18c..028f3faf46e7 100644

tools/include/linux/mm.h line 10

Quoted 7 lines
tools/include/linux/mm.h +1 -0
@@ -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)