diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f51aa6051a99..37d111184eee 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4604,8 +4604,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, goto retry; /* Reclaim/compaction failed to prevent the fallback */ - if (defrag_mode) { - alloc_flags &= ALLOC_NOFRAGMENT; + if (defrag_mode && (alloc_flags & ALLOC_NOFRAGMENT)) { + alloc_flags &= ~ALLOC_NOFRAGMENT; goto retry; }