From: pratyush.brahma@oss.qualcomm.com
To: Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Pratyush Brahma <pratyush.brahma@oss.qualcomm.com>
Subject: [PATCH 1/2] mm/numa_emulation: Refactor NUMA emulation size handling to use kernel macros
Date: Fri, 26 Sep 2025 16:04:49 +0530 [thread overview]
Message-ID: <20250926-numa-emu-v1-1-714f2691bf8b@oss.qualcomm.com> (raw)
In-Reply-To: <20250926-numa-emu-v1-0-714f2691bf8b@oss.qualcomm.com>
From: Pratyush Brahma <pratyush.brahma@oss.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@oss.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
next prev parent reply other threads:[~2025-09-26 11:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-26 10:34 [PATCH 0/2] (no cover subject) pratyush.brahma
2025-09-26 10:34 ` pratyush.brahma [this message]
2025-09-26 10:34 ` [PATCH 2/2] mm/numa_emulation: Move the size calculation in split_nodes_interleave() to a separate function pratyush.brahma
2025-09-26 13:48 ` Christophe Leroy
2025-09-29 7:16 ` Pratyush Brahma
2025-10-07 2:48 ` Pratyush Brahma
2025-10-07 4:23 ` [PATCH 0/2] (no cover subject) Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250926-numa-emu-v1-1-714f2691bf8b@oss.qualcomm.com \
--to=pratyush.brahma@oss.qualcomm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox