Skip to content

Commit 4647c4d

Browse files
Pratyush Brahmarppt
authored andcommitted
mm: numa,memblock: Use SZ_1M macro to denote bytes to MB conversion
Replace the manual bitwise conversion of bytes to MB with SZ_1M macro, a standard macro used within the mm subsystem, to improve readability. Signed-off-by: Pratyush Brahma <pratyush.brahma@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250820-numa-memblks-refac-v2-1-43bf1af02acd@oss.qualcomm.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
1 parent d045c31 commit 4647c4d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

mm/memblock.c

Lines changed: 2 additions & 2 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

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)