From ab63f81b3a62158d195690ca51a65a8a27eb1aad Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 9 Sep 2024 15:42:07 +0000 Subject: [PATCH] Revert "mm/page_alloc: Separate THP PCP into movable and non-movable categories" This reverts commit 447434eaaf3f057a59557ae2a1f94db09e0f296a which is commit bf14ed81f571f8dba31cd72ab2e50fbcc877cc31 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Iaa26387f63a15f47d85e04a1317c08e2d0137768 Signed-off-by: Greg Kroah-Hartman --- include/linux/mmzone.h | 9 +++++---- mm/page_alloc.c | 8 ++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6293226c213e..6f23778a72c5 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -667,12 +667,13 @@ enum zone_watermarks { }; /* - * One per migratetype for each PAGE_ALLOC_COSTLY_ORDER. Two additional lists - * are added for THP. One PCP list is used by GPF_MOVABLE, and the other PCP list - * is used by GFP_UNMOVABLE and GFP_RECLAIMABLE. + * One per migratetype for each PAGE_ALLOC_COSTLY_ORDER. One additional list + * for THP which will usually be GFP_MOVABLE. Even if it is another type, + * it should not contribute to serious fragmentation causing THP allocation + * failures. */ #ifdef CONFIG_TRANSPARENT_HUGEPAGE -#define NR_PCP_THP 2 +#define NR_PCP_THP 1 #else #define NR_PCP_THP 0 #endif diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0f7d95ac3065..a2b942088ea3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -753,16 +753,12 @@ out: static inline unsigned int order_to_pindex(int migratetype, int order) { - bool __maybe_unused movable; int base = order; #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (order > PAGE_ALLOC_COSTLY_ORDER) { VM_BUG_ON(order != pageblock_order); - - movable = migratetype == MIGRATE_MOVABLE; - - return NR_LOWORDER_PCP_LISTS + movable; + return NR_LOWORDER_PCP_LISTS; } #else VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER); @@ -776,7 +772,7 @@ static inline int pindex_to_order(unsigned int pindex) int order = pindex / MIGRATE_PCPTYPES; #ifdef CONFIG_TRANSPARENT_HUGEPAGE - if (pindex >= NR_LOWORDER_PCP_LISTS) + if (pindex == NR_LOWORDER_PCP_LISTS) order = pageblock_order; #else VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);