Re: + mm-thp-always-specify-disabled-vmas-as-nh-in-smaps.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 28, 2018 at 01:29:33PM -0800, David Rientjes wrote:
> On Fri, 28 Dec 2018, Michal Hocko wrote:
> 
> > > > And if the
> > > > application later enables THP by the prctl then existing mappings would
> > > > never get the THP enabled status back.
> > > > 
> > > 
> > > If do prctl(PR_SET_THP_DISABLE, 0) later to clear the disabling, my patch 
> > > is a no-op, smaps reports whether the vma is eligible for hugepages 
> > > depending on MADV_HUGEPAGE or not, which also matches the implementation 
> > > of transparent_hugepage_enabled().
> > > 
> > > Where is the issue?
> > 
> > How do you clear the NOHUGE flag in pre-existing vmas to the original
> > value? You cannot tell vmas with explicit NOHUGE flag set by madvise and
> > those reported due the prctl value.
> > 
> > In other words. Consider a CRIU-like usecase when you snapshot an application
> > at some point of time, restore it and let the application run again
> > and it does (PR_SET_THP_DISABLE, 0). All the pre-existing vmas will
> > retain their NOHUGE vma flag and as such will be excluded from THP.
> > Application will behave differently from before the snaphost which looks
> > like a bug, right?
> > 
> 
> Smaps reveals the state of each vma at the moment it is read, not the 
> future, this has always been the case before and after the broken commit; 
> it's not intended to be something that can specify "thp is currently 
> disabled, but if we did prctl(PR_SET_THP_DISABLE, 0), this vma has done 
> madvise(MADV_HUGEPAGE), and we are on a thp enabled == madvise host, so 
> it would be eligible for thp."

The point of CRIU is that it tries to save and re-create the state of the
process.

With your fix, "nh" in VMA flags can mean two different things:
 - MADV_NOHUGEPAGE was called for the VMA, or
 - prctl(PR_SET_THP_DISABLE) was called for the whole process

Current CRIU code assumes that "nh" means MADV_NOHUGEPAGE. But if it was
due to prctl(PR_SET_THP_DISABLE) the process state will not be restored
correctly: all VMAs will be restored with MADV_NOHUGEPAGE and future
re-enabling THP with prctl(PR_SET_THP_DISABLE) for restored process will
not have any effect. VMAs stay not eligble for THP.

-- 
 Kirill A. Shutemov



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux