diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b6ce214b59ef02fc33460a02ddf997846a6d0e88..52b46337b4d89d13be8b6dd267828257185b62d2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4506,6 +4506,20 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, compact_result == COMPACT_DEFERRED) goto nopage; + /* + * THP page faults may attempt local node only first, + * but are then allowed to only compact, not reclaim, + * see alloc_pages_mpol(). + * + * Compaction can fail for other reasons than those + * checked above and we don't want such THP allocations + * to put reclaim pressure on a single node in a + * situation where other nodes might have plenty of + * available memory. + */ + if (gfp_mask & __GFP_THISNODE) + goto nopage; + /* * Looks like reclaim/compaction is worth trying, but * sync compaction could be very expensive, so keep