* [PATCH] x86/mm: Optimize the for loop in numa_nodemask_from_meminfo()
@ 2023-12-07 13:16 Yuntao Wang
0 siblings, 0 replies; only message in thread
From: Yuntao Wang @ 2023-12-07 13:16 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, H. Peter Anvin, Yuntao Wang
Since only the first `mi->nr_blks` elements of the `mi->blk` array contain
valid data, we do not need to iterate over the entire array.
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
arch/x86/mm/numa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index b29ceb19e46e..e84f14a9462d 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -339,7 +339,7 @@ static void __init numa_nodemask_from_meminfo(nodemask_t *nodemask,
{
int i;
- for (i = 0; i < ARRAY_SIZE(mi->blk); i++)
+ for (i = 0; i < mi->nr_blks; i++)
if (mi->blk[i].start != mi->blk[i].end &&
mi->blk[i].nid != NUMA_NO_NODE)
node_set(mi->blk[i].nid, *nodemask);
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-07 13:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07 13:16 [PATCH] x86/mm: Optimize the for loop in numa_nodemask_from_meminfo() Yuntao Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®