Hi Andrew, Vlastimil has pointed out[1] that using compaction_withdrawn() for THP allocations has some non-trivial consequences. While I still think that the check is OK it is true we shouldn't sneak in a potential behavior change into something that basically provides an API. So can you fold the following partial revert into the original patch please? [1] http://lkml.kernel.org/r/570BB719.2030007@xxxxxxx --- >From 71ddeee4238e33d67ef07883e73f946a7cc40e73 Mon Sep 17 00:00:00 2001 From: Michal Hocko <mhocko@xxxxxxxx> Date: Mon, 11 Apr 2016 17:38:22 +0200 Subject: [PATCH] ction-abstract-compaction-feedback-to-helpers-fix Preserve the original thp back off checks to not introduce any functional changes as per Vlastimil. Signed-off-by: Michal Hocko <mhocko@xxxxxxxx> --- mm/page_alloc.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c05de84c8157..c37e6d1ad643 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3362,12 +3362,25 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, if (page) goto got_pg; - /* - * Checks for THP-specific high-order allocations and back off - * if the the compaction backed off - */ - if (is_thp_gfp_mask(gfp_mask) && compaction_withdrawn(compact_result)) - goto nopage; + /* Checks for THP-specific high-order allocations */ + if (is_thp_gfp_mask(gfp_mask)) { + /* + * If compaction is deferred for high-order allocations, it is + * because sync compaction recently failed. If this is the case + * and the caller requested a THP allocation, we do not want + * to heavily disrupt the system, so we fail the allocation + * instead of entering direct reclaim. + */ + if (compact_result == COMPACT_DEFERRED) + goto nopage; + + /* + * Compaction is contended so rather back off than cause + * excessive stalls. + */ + if(compact_result == COMPACT_CONTENDED) + goto nopage; + } /* * It can become very expensive to allocate transparent hugepages at -- 2.8.0.rc3 -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>