Skip to content

Commit 5b9f3b0

Browse files
committed
Merge tag 'fixes-2025-08-28' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock fixes from Mike Rapoport: - printk cleanups in memblock and numa_memblks - update kernel-doc for MEMBLOCK_RSRV_NOINIT to be more accurate and detailed * tag 'fixes-2025-08-28' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: memblock: fix kernel-doc for MEMBLOCK_RSRV_NOINIT mm: numa,memblock: Use SZ_1M macro to denote bytes to MB conversion mm/numa_memblks: Use pr_debug instead of printk(KERN_DEBUG)
2 parents 606c2cf + b3dcc9d commit 5b9f3b0

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

include/linux/memblock.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ extern unsigned long long max_possible_pfn;
4040
* via a driver, and never indicated in the firmware-provided memory map as
4141
* system RAM. This corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED in the
4242
* kernel resource tree.
43-
* @MEMBLOCK_RSRV_NOINIT: memory region for which struct pages are
44-
* not initialized (only for reserved regions).
43+
* @MEMBLOCK_RSRV_NOINIT: reserved memory region for which struct pages are not
44+
* fully initialized. Users of this flag are responsible to properly initialize
45+
* struct pages of this region
4546
* @MEMBLOCK_RSRV_KERN: memory region that is reserved for kernel use,
4647
* either explictitly with memblock_reserve_kern() or via memblock
4748
* allocation APIs. All memblock allocations set this flag.

mm/memblock.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,9 @@ bool __init_memblock memblock_validate_numa_coverage(unsigned long threshold_byt
780780
}
781781

782782
if ((nr_pages << PAGE_SHIFT) > threshold_bytes) {
783-
mem_size_mb = memblock_phys_mem_size() >> 20;
783+
mem_size_mb = memblock_phys_mem_size() / SZ_1M;
784784
pr_err("NUMA: no nodes coverage for %luMB of %luMB RAM\n",
785-
(nr_pages << PAGE_SHIFT) >> 20, mem_size_mb);
785+
(nr_pages << PAGE_SHIFT) / SZ_1M, mem_size_mb);
786786
return false;
787787
}
788788

@@ -1091,13 +1091,20 @@ int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size)
10911091

10921092
/**
10931093
* memblock_reserved_mark_noinit - Mark a reserved memory region with flag
1094-
* MEMBLOCK_RSRV_NOINIT which results in the struct pages not being initialized
1095-
* for this region.
1094+
* MEMBLOCK_RSRV_NOINIT
1095+
*
10961096
* @base: the base phys addr of the region
10971097
* @size: the size of the region
10981098
*
1099-
* struct pages will not be initialized for reserved memory regions marked with
1100-
* %MEMBLOCK_RSRV_NOINIT.
1099+
* The struct pages for the reserved regions marked %MEMBLOCK_RSRV_NOINIT will
1100+
* not be fully initialized to allow the caller optimize their initialization.
1101+
*
1102+
* When %CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled, setting this flag
1103+
* completely bypasses the initialization of struct pages for such region.
1104+
*
1105+
* When %CONFIG_DEFERRED_STRUCT_PAGE_INIT is disabled, struct pages in this
1106+
* region will be initialized with default values but won't be marked as
1107+
* reserved.
11011108
*
11021109
* Return: 0 on success, -errno on failure.
11031110
*/

mm/numa_emulation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static int __init emu_setup_memblk(struct numa_meminfo *ei,
7373
}
7474

7575
printk(KERN_INFO "Faking node %d at [mem %#018Lx-%#018Lx] (%LuMB)\n",
76-
nid, eb->start, eb->end - 1, (eb->end - eb->start) >> 20);
76+
nid, eb->start, eb->end - 1, (eb->end - eb->start) / SZ_1M);
7777
return 0;
7878
}
7979

@@ -264,7 +264,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei,
264264
min_size = ALIGN(max(min_size, FAKE_NODE_MIN_SIZE), FAKE_NODE_MIN_SIZE);
265265
if (size < min_size) {
266266
pr_err("Fake node size %LuMB too small, increasing to %LuMB\n",
267-
size >> 20, min_size >> 20);
267+
size / SZ_1M, min_size / SZ_1M);
268268
size = min_size;
269269
}
270270
size = ALIGN_DOWN(size, FAKE_NODE_MIN_SIZE);

mm/numa_memblks.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int __init numa_alloc_distance(void)
7676
for (j = 0; j < cnt; j++)
7777
numa_distance[i * cnt + j] = i == j ?
7878
LOCAL_DISTANCE : REMOTE_DISTANCE;
79-
printk(KERN_DEBUG "NUMA: Initialized distance table, cnt=%d\n", cnt);
79+
pr_debug("NUMA: Initialized distance table, cnt=%d\n", cnt);
8080

8181
return 0;
8282
}
@@ -427,9 +427,9 @@ static int __init numa_register_meminfo(struct numa_meminfo *mi)
427427
unsigned long pfn_align = node_map_pfn_alignment();
428428

429429
if (pfn_align && pfn_align < PAGES_PER_SECTION) {
430-
unsigned long node_align_mb = PFN_PHYS(pfn_align) >> 20;
430+
unsigned long node_align_mb = PFN_PHYS(pfn_align) / SZ_1M;
431431

432-
unsigned long sect_align_mb = PFN_PHYS(PAGES_PER_SECTION) >> 20;
432+
unsigned long sect_align_mb = PFN_PHYS(PAGES_PER_SECTION) / SZ_1M;
433433

434434
pr_warn("Node alignment %luMB < min %luMB, rejecting NUMA config\n",
435435
node_align_mb, sect_align_mb);

0 commit comments

Comments
 (0)