Thanks for the review, David! On Thu, May 12, 2022 at 1:03 PM David Rientjes <rientjes@xxxxxxxxxx> wrote: > > 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? > I think this is fine with a "enforce_page_heuristics" flag or something. Ofc, functionally unifying the flags is a noop, but I was trying to to avoid "if (khugepagd) .. else .." and, where possible, describe the variable properties of the collapse in struct collapse_control itself. If there's no objections, I'll make that change for v6. > Either way: > > Acked-by: David Rientjes <rientjes@xxxxxxxxxx>