Re: [RFC PATCH] mm, proc: report PR_SET_THP_DISABLE in proc
From: Michal Hocko
Date: Thu Oct 04 2018 - 01:58:50 EST
On Wed 03-10-18 15:51:05, David Rientjes wrote:
> On Wed, 3 Oct 2018, Michal Hocko wrote:
>
> > > > So how about this? (not tested yet but it should be pretty
> > > > straightforward)
> > >
> > > Umm, prctl(PR_GET_THP_DISABLE)?
> >
> > /me confused. I thought you want to query for the flag on a
> > _different_ process.
>
> Why would we want to check three locations (system wide setting, prctl
> setting, madvise setting) to determine if a heap can be backed by thp?
Because we simply have 3 different ways to control THP? Is this a real
problem?
> If the nh flag being exported to VmFlag is to be extended beyond what my
> patch did, I suggest (1) it does it for the system wide setting as well
> and/or (2) calling a helper function to determine if the vma could be
> backed by thp in the first place regardless of any setting to determine if
> nh/hg is important.
>
> The last thing I suggest is done is adding a third place to check.
But conflating the three ways into a single exported symbol (be it nh
or something else) just makes the api more confusing longterm. I am
pretty sure we have made that mistake in the past already.
What if somebody really wants to check for PR_SET_THP_DISABLE? There is
currently no way to do that on a remote process right now AFAICS. So it
makes sense to export the state in general. Any exported API should be
about consistency. If you want to combine all three checks then
just do that in the userspace or in a library function.
--
Michal Hocko
SUSE Labs