From 5740533ccd74b925a96ac677c9424d4925f36e17 Mon Sep 17 00:00:00 2001 From: Liam Mark Date: Wed, 25 Jul 2018 10:24:55 -0700 Subject: [PATCH 1/2] 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 --- include/linux/gfp.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 0a5e1e7983ed..8abea3e45d0b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -455,7 +455,14 @@ static inline bool gfpflags_normal_context(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); From 64c5b175c6a80ab285d9b9c7e60492aa563e7479 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Mon, 2 Dec 2019 14:20:29 -0800 Subject: [PATCH 2/2] arm64: defconfig: Enable CMA performance optimizations on Lahaina Enable CONFIG_CMA_DIRECT_UTILIZATION and CONFIG_CMA_PCP_LISTS to increase CMA utilization, and thus, improve memory utilization. Change-Id: I2caa8d9f913bce8aa0171100f767c30e261074a6 Signed-off-by: Isaac J. Manjarres --- arch/arm64/configs/vendor/lahaina_QGKI.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/configs/vendor/lahaina_QGKI.config b/arch/arm64/configs/vendor/lahaina_QGKI.config index 457e09fb144e..eff9ea6dbf69 100644 --- a/arch/arm64/configs/vendor/lahaina_QGKI.config +++ b/arch/arm64/configs/vendor/lahaina_QGKI.config @@ -38,6 +38,8 @@ CONFIG_QCOM_MEM_OFFLINE=y CONFIG_OVERRIDE_MEMORY_LIMIT=y CONFIG_VM_EVENT_COUNT_CLEAN_PAGE_RECLAIM=y CONFIG_BALANCE_ANON_FILE_RECLAIM=y +CONFIG_CMA_DIRECT_UTILIZATION=y +CONFIG_CMA_PCP_LISTS=y # CONFIG_ZONE_DEVICE is not set # CONFIG_BUG_ON_HW_MEM_ONLINE_FAIL is not set CONFIG_MSM_BT_POWER=m