Re: [PATCH 1/8] mm/khugepaged: refactor per-scan state clearing into collapse_control_init_scan()
From: Baolin Wang
Date: Fri Jul 10 2026 - 03:29:26 EST
On 7/7/26 1:07 AM, Usama Arif wrote:
On Mon, 6 Jul 2026 09:44:48 -0600 Nico Pache <npache@xxxxxxxxxx> wrote:
Extract the repeated clearing of node_load, alloc_nmask, and
mthp_present_ptes into a helper to reduce duplication in
collapse_scan_pmd() and collapse_scan_file(). Althought file scans do not
current use the bitmap, they will in the future, and clearing it now is
harmless.
Signed-off-by: Nico Pache <npache@xxxxxxxxxx>
---
mm/khugepaged.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 617bca76db49..b3985b854e77 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -628,6 +628,17 @@ void __khugepaged_exit(struct mm_struct *mm)
}
}
+/*
+ * collapse_control_init_scan() - initialize/reset collapse_control variables
+ * that require being cleared once per-scan.
+ */
Probably don't need the above comment, but apart from that
Agree. The code is self-explanatory.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>