From 464ddce4070dfa9633c25d958adffaa3f3ef5a75 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Thu, 26 Jun 2025 13:25:58 -0700 Subject: [PATCH] ANDROID: mthp: Prevent TAO non-movable allocations from movable zone aosp/I30ac33034f0ff697a4330ef752babf94d4e234f5 removed the ability to allocate non-movable __GPF_COMP allocations from TAO zones as they could fallback to the movable-zone; causing various issues. This was reintroduced by aosp/I2fdfc4df8b03daa96fd6c2c8c6630d26a8509ad0 iff the movable zone is not enabled; adding additional checks to verify this. However the case of movable_node command line parameter was missed; when this is set memory blocks can be onlined into the movable-zone. Add a check for !movable_node_is_enabled() to avoid such __GPF_COMP allocations from TAO (virtual zones) if it's possible that memory blocks can come online to the movable-zone. Bug: 427924381 Bug: 313807618 Bug: 353906885 Change-Id: If2ebd4d7f4badd99599b01939cd89d0cba9b3fb5 Signed-off-by: Kalesh Singh --- include/linux/gfp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 43dc4463388b..808caa5c170c 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -139,9 +139,9 @@ static inline enum zone_type __gfp_zone(gfp_t flags) if (z == ZONE_MOVABLE) return LAST_VIRT_ZONE; - /* Allow dma-buf etc to use virtual zones */ + /* Allow dma-buf etc to use virtual zones, if there is no movable zone */ if ((flags & __GFP_COMP) && (flags & __GFP_HIGHMEM) && - !static_branch_unlikely(&movablecore_enabled)) + !static_branch_unlikely(&movablecore_enabled) && !movable_node_is_enabled()) return LAST_VIRT_ZONE; return z;