On Fri, Feb 2, 2024 at 6:06 PM Michal Hocko <mhocko@xxxxxxxx> wrote: > > On Thu 01-02-24 20:52:26, Lance Yang wrote: > > The collapsing behavior of khugepaged with pages > > marked using MADV_FREE might cause confusion > > among users. > > > > For instance, allocate a 2MB chunk using mmap and > > later release it by MADV_FREE. Khugepaged will not > > collapse this chunk. From the user's perspective, > > it treats lazyfree pages as pte_none. However, > > for some pages marked as lazyfree with MADV_FREE, > > khugepaged might collapse this chunk and copy > > these pages to a new huge page. This inconsistency > > in behavior could be confusing for users. > > Is that any more confusing than collapsing pte_none > pages? > > TBH I do not really see why this is a problem. MADV_FREE > are correctly recognized same as pte_none so the user > defined trashold applies. Sorry, I might not have expressed it clearly. MADV_FREE is correctly recognized, just like pte_none. This is also reasonable and not an issue. IMO, since it's treated the same as pte_none, perhaps lazyfree pages shouldn't be copied to the new huge page. Thanks, Lance > -- > Michal Hocko > SUSE Labs