On 22 May 2026, at 10:59, Nico Pache wrote: > The following cleanup reworks all the max_ptes_* handling into helper > functions. This increases the code readability and will later be used to > implement the mTHP handling of these variables. > > With these changes we abstract all the madvise_collapse() special casing > (do not respect the sysctls) away from the functions that utilize them. > And will be used later in this series to cleanly restrict the mTHP > collapse behavior. > > No functional change is intended; however, we are now only reading the > sysfs variables once per scan, whereas before these variables were being > read on each loop iteration. > > Reviewed-by: Lance Yang <[email protected]> > Suggested-by: David Hildenbrand <[email protected]> > Acked-by: David Hildenbrand (Arm) <[email protected]> > Acked-by: Usama Arif <[email protected]> > Signed-off-by: Nico Pache <[email protected]> > --- > mm/khugepaged.c | 120 +++++++++++++++++++++++++++++++++--------------- > 1 file changed, 84 insertions(+), 36 deletions(-) >
userfaultfd_armed() and cc->is_khugepaged check results are now folded into collapse_max_ptes_*() return values, using 0 and HPAGE_PMD_NR. It simplifies the caller code. LGTM. Reviewed-by: Zi Yan <[email protected]> Best Regards, Yan, Zi
