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 <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2025-06-26 13:25:58 -07:00
parent 75a0fcbfdf
commit 464ddce407

View File

@@ -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;