diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 623f6e5b583a..10708f37575d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4789,6 +4789,20 @@ restart: 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