[Dropped Richard Henderson from the CC list as the delivery fails for him] On Thu 10-03-22 10:54:03, David Rientjes wrote: > On Thu, 10 Mar 2022, David Hildenbrand wrote: > > > On 08.03.22 22:34, Zach O'Keefe wrote: > > > In madvise collapse context, we optionally want to be able to ignore > > > advice from MADV_NOHUGEPAGE-marked regions. > > > > > > Add a vm_flags_ignore argument to hugepage_vma_revalidate_pmd_count() > > > which can be used to ignore vm flags used when considering thp > > > eligibility. > > > > arch/s390/mm/gmap.c:thp_split_mm() sets VM_NOHUGEPAGE to make sure there > > are *really* no thp. Being able to bypass that would break KVM horribly. > > > > Ignoring MADV_NOHUGEPAGE/VM_NOHUGEPAGE feels like the wrong way to go. > > > > Agreed, we'll have to remove this possibility. yeah, this sounds like a bug to me. > > What about a prctl instead, to disable any khugepagd activity and just > > let that process control it manually? > > > > No objection to the prctl, although it's unfortunate that the existing > PR_SET_THP_DISABLE simply disables thp for the process entirely for any > non-zero value and that this wasn't implemented as a bitmask to specify > future behavior where this new behavior could be defined :/ I do not think PR_SET_THP_DISABLE is any different from VM_NOHUGEPAGE. The process (owner) has opeted out from THPs for different reasons. Those might be unknown to whoever calls the madvise call (including itself). -- Michal Hocko SUSE Labs