Re: [patch] mm, thp: add new background defrag option

From: David Rientjes
Date: Tue Jan 10 2017 - 18:52:40 EST


On Tue, 10 Jan 2017, Vlastimil Babka wrote:

> > I get very confused by the /sys/kernel/mm/transparent_hugepage/defrag
> > versus enabled flags, and this may be a terrible, even more confusing,
> > idea: but I've been surprised and sad to see defrag with a "defer"
> > option, but poor enabled without one; and it has crossed my mind that
> > perhaps the peculiar "madvise+defer" syntax in defrag might rather be
> > handled by "madvise" in defrag with "defer" in enabled? Or something
> > like that: 4 x 4 possibilities instead of 5 x 3.
>
> But would all the possibilities make sense? For example, if I saw
> "defer" in enabled, my first expectation would be that it would only use
> khugepaged, and no THP page faults at all - possibly including madvised
> regions.
>

And this is why I've tried to minimize the config requirements and respect
userspace decisions to do MADV_HUGEPAGE, MADV_NOHUGEPAGE, or set/clear
PR_SET_THP_DISABLE because all these system-wide options combined with
userspace syscalls truly seems unmaintainable and waay too confusing to
correctly describe. Owell, I am fine with introducing
yet-another-defrag-mode if it lets us move in a direction that supports
our usecase.