[PATCH 07/12] mm/collapse: name the per-table scan reset for what it resets

From: Kiryl Shutsemau

Date: Fri Sep 04 2026 - 12:55:08 EST


From: "Kiryl Shutsemau (Meta)" <kas@xxxxxxxxxx>

collapse_control_init_scan() resets what one scan accumulates: the node
load, the allocation nodemask and the eligible-PTE bitmap. It runs before
every PTE table a scan is given, not once per control, so its name points
at the wrong thing.

Call it collapse_scan_reset().

Preparation for giving a control a real init and release, run once each
for a whole series of scans. Two names a word apart would then stand for
two different jobs.

No functional change.

Assisted-by: Claude-Code:claude-opus-5
Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
---
mm/khugepaged.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 22272cfe97e6..511ffb381fe9 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -550,7 +550,7 @@ void __khugepaged_exit(struct mm_struct *mm)
}
}

-static void collapse_control_init_scan(struct collapse_control *cc)
+static void collapse_scan_reset(struct collapse_control *cc)
{
memset(cc->node_load, 0, sizeof(cc->node_load));
nodes_clear(cc->alloc_nmask);
@@ -1579,7 +1579,7 @@ static enum scan_result collapse_scan_pmd(struct mm_struct *mm,
goto out;
}

- collapse_control_init_scan(cc);
+ collapse_scan_reset(cc);

enabled_orders = collapse_possible_orders(vma, vma->vm_flags, tva_flags);

@@ -2660,7 +2660,7 @@ static enum scan_result collapse_scan_file(struct mm_struct *mm,

present = 0;
swap = 0;
- collapse_control_init_scan(cc);
+ collapse_scan_reset(cc);
rcu_read_lock();
xas_for_each(&xas, folio, start + HPAGE_PMD_NR - 1) {
if (xas_retry(&xas, folio))
--
2.54.0