On 11/02/25 1:59 pm, Wei Yang wrote:
At the beginning of find_zone_movable_pfns_for_nodes(), it has properly
set node_states[N_MEMORY] in early_calculate_totalpages().
Instead of iterate on all possible nodes, we can just do the alignment
on nodes with memory.
Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
mm/mm_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 35754a8ae6c0..3ec50b5fda12 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -547,7 +547,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
out2:
/* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
- for (nid = 0; nid < MAX_NUMNODES; nid++) {
+ for_each_node_state(nid, N_MEMORY) {
unsigned long start_pfn, end_pfn;
zone_movable_pfn[nid] =
I have boot tested this, and also read the code and it makes sense: The
only flag which gives the possibility of ZONE_MOVABLE is N_MEMORY, and
it gets set in early_calculate_totalpages(), and before the label out2,
no function plays with node_states[]. So please consider:
Reviewed-by: Dev Jain <dev.jain@xxxxxxx>