On Wed, 4 May 2022, Zach O'Keefe wrote: > Add enforce_young flag to struct collapse_control that allows context to > ignore requirement that some pages in region being collapsed be young or > referenced. Set this flag in khugepaged collapse context to preserve > existing khugepaged behavior. > > This flag will be used (unset) when introducing madvise collapse > context since here, the user presumably has reason to believe the > collapse will be beneficial and khugepaged heuristics shouldn't tell > the user they are wrong. > > Signed-off-by: Zach O'Keefe <zokeefe@xxxxxxxxxx> > --- > mm/khugepaged.c | 23 +++++++++++++++-------- > 1 file changed, 15 insertions(+), 8 deletions(-) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index ca730aec0e3e..b14807b7002e 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -90,6 +90,9 @@ struct collapse_control { > /* Respect khugepaged_max_ptes_[none|swap|shared] */ > bool enforce_pte_scan_limits; > > + /* Require memory to be young */ > + bool enforce_young; > + > /* Num pages scanned per node */ > int node_load[MAX_NUMNODES]; > Small nit: is it possible to unify these into a single bool khugepaged flag? Either way: Acked-by: David Rientjes <rientjes@xxxxxxxxxx>