mm/page_alloc.c: apply gfp_allowed_mask before the first allocation attempt
Subsystems (2)
[email protected]
maintainerPATCH 45/126 mm/page_alloc.c: apply gfp_allowed_mask before the first allocation attempt
From: Tetsuo Handa <[email protected]>
Subject: mm/page_alloc.c: apply gfp_allowed_mask before the first allocation attempt
We are by error initializing alloc_flags before gfp_allowed_mask is applied. This could cause problems after pm_restrict_gfp_mask() is called during suspend operation. Apply gfp_allowed_mask before initializing alloc_flags so that the first allocation attempt uses correct flags.
Fixes 83d4ca8148fd9092 ("mm, page_alloc: move __GFP_HARDWALL modifications out of the fastpath")
Signed-off-by Tetsuo Handa <[email protected]>
Acked-by Michal Hocko <[email protected]>
Acked-by Vlastimil Babka <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Jesper Dangaard Brouer <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mmpage_alloc-apply-gfp_allowed_mask-before-the-first-allocation-attempt +2 -1
@@ -4183,10 +4183,11 @@ __alloc_pages_nodemask(gfp_t gfp_mask, u {struct page *page;unsigned int alloc_flags =ALLOC_WMARK_LOW ; -gfp_t alloc_mask = gfp_mask;/* The gfp_t that was actually used for allocation */ +gfp_t alloc_mask;/* The gfp_t that was actually used for allocation */ struct alloc_context ac = { }; gfp_mask &= gfp_allowed_mask; + alloc_mask = gfp_mask;if (!prepare_alloc_pages (gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags))return NULL ;
_