[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250926-numa-emu-v1-1-714f2691bf8b@oss.qualcomm.com>
Date: Fri, 26 Sep 2025 16:04:49 +0530
From: pratyush.brahma@....qualcomm.com
To: Andrew Morton <akpm@...ux-foundation.org>, Mike Rapoport <rppt@...nel.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Pratyush Brahma <pratyush.brahma@....qualcomm.com>
Subject: [PATCH 1/2] mm/numa_emulation: Refactor NUMA emulation size
handling to use kernel macros
From: Pratyush Brahma <pratyush.brahma@....qualcomm.com>
Replace hard‑coded 32 MB constant with SZ_32M and apply ALIGN_DOWN for
clearer calculations and maintainability. Update the related hash mask
usage accordingly to improve readability.
Signed-off-by: Pratyush Brahma <pratyush.brahma@....qualcomm.com>
---
mm/numa_emulation.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c
index 703c8fa05048..2a335b3dd46a 100644
--- a/mm/numa_emulation.c
+++ b/mm/numa_emulation.c
@@ -10,8 +10,7 @@
#include <asm/numa.h>
#include <acpi/acpi_numa.h>
-#define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
-#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
+#define FAKE_NODE_MIN_SIZE SZ_32M
int emu_nid_to_phys[MAX_NUMNODES];
static char *emu_cmdline __initdata;
@@ -112,10 +111,10 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei,
* Calculate the number of big nodes that can be allocated as a result
* of consolidating the remainder.
*/
- big = ((size & ~FAKE_NODE_MIN_HASH_MASK) * nr_nodes) /
+ big = ((size & (FAKE_NODE_MIN_SIZE - 1UL)) * nr_nodes) /
FAKE_NODE_MIN_SIZE;
- size &= FAKE_NODE_MIN_HASH_MASK;
+ size = ALIGN_DOWN(size, FAKE_NODE_MIN_SIZE);
if (!size) {
pr_err("Not enough memory for each node. "
"NUMA emulation disabled.\n");
--
2.34.1
Powered by blists - more mailing lists