mm: Allow only __GFP_CMA allocations from Movable zone

Ensure that only allocations which include __GFP_CMA can be satisfied from
zone Movable. This restriction helps reduces the likelihood of a page in
the movable zone being pinned which would prevent memory from being
offlined.

Change-Id: I570970ff848d4a7147f3ccda2b294f08bcdf88d8
Signed-off-by: Liam Mark <lmark@codeaurora.org>
This commit is contained in:
Liam Mark authored and Swathi Sridhar committed 2019-02-12 13:47:27 -08:00
1 parent c609d5c075
commit 0157fbd79d
1 file changed
+8 -1
+8 -1
View File
@@ -420,7 +420,14 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
static inline enum zone_type gfp_zone(gfp_t flags)
{
enum zone_type z;
int bit = (__force int) (flags & GFP_ZONEMASK);
int bit;
if (!IS_ENABLED(CONFIG_HIGHMEM)) {
if ((flags & __GFP_MOVABLE) && !(flags & __GFP_CMA))
flags &= ~__GFP_HIGHMEM;
}
bit = (__force int) (flags & GFP_ZONEMASK);
z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
((1 << GFP_ZONES_SHIFT) - 1);