I missed folding a list walking fix. Use this diff on top for testing. diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c index b2da34a1f06c..f3d720b7dc6c 100644 --- a/mm/memory-tiers.c +++ b/mm/memory-tiers.c @@ -300,12 +300,12 @@ static void establish_migration_targets(void) nd = &node_demotion[node]; memtier = __node_get_memory_tier(node); - if (!memtier || list_is_last(&memtier->list, &memory_tiers)) + if (!memtier || list_is_first(&memtier->list, &memory_tiers)) continue; /* * Get the next memtier to find the demotion node list. */ - memtier = list_next_entry(memtier, list); + memtier = list_prev_entry(memtier, list); /* * find_next_best_node, use 'used' nodemask as a skip list. @@ -342,7 +342,7 @@ static void establish_migration_targets(void) * Once we detect such a memory tier, we consider that tier * as top tiper from which promotion is not allowed. */ - list_for_each_entry_reverse(memtier, &memory_tiers, list) { + list_for_each_entry(memtier, &memory_tiers, list) { nodes_and(used, node_states[N_CPU], memtier->nodelist); if (!nodes_empty(used)) { top_tier_id = memtier->id; @@ -364,7 +364,7 @@ static void establish_migration_targets(void) */ nodes_and(lower_tier, node_states[N_MEMORY], lower_tier); - list_for_each_entry(memtier, &memory_tiers, list) { + list_for_each_entry_reverse(memtier, &memory_tiers, list) { /* * Keep removing current tier from lower_tier nodes, * This will remove all nodes in current and above