Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0157fbd7 authored by Liam Mark's avatar Liam Mark Committed by Swathi Sridhar
Browse files

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: default avatarLiam Mark <lmark@codeaurora.org>
parent c609d5c0
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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);