Re: [PATCH 1/1] mm: thp: Redefine default THP defrag behaviour disable it by default

From: Mel Gorman
Date: Fri Feb 26 2016 - 05:52:39 EST

On Thu, Feb 25, 2016 at 02:45:24PM -0500, Johannes Weiner wrote:
> > THP gives impressive gains in some cases but only if they are quickly
> > available. We're not going to reach the point where they are completely
> > free so lets take the costs out of the fast paths finally and defer the
> > cost to kswapd, kcompactd and khugepaged where it belongs.
> >
> > Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> The cornercases Rik pointed out aside, if the mapping isn't long-lived
> enough that it can wait for khugepaged, what are the odds that the
> defrag work will be offset by the TLB savings? However, for mappings
> where it would pay off, having to do the same defrag work but doing it
> at a later time is actually a net loss. Should we consider keeping
> direct reclaim and compaction as a configurable option as least?

Yes, I think so. I've a prototype now that makes it configurable and am
running some tests. I'll preserve your and Rik's ack in V2 as the patch
will be different but the default behaviour will be very similar.

Mel Gorman