[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241202090728.78935-1-anshuman.khandual@arm.com>
Date: Mon, 2 Dec 2024 14:37:28 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: linux-mm@...ck.org
Cc: Anshuman Khandual <anshuman.khandual@....com>,
Muchun Song <muchun.song@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] mm/hugetlb: Make __NR_USED_SUBPAGE check conditional
The HugeTLB order check against __NR_USED_SUBPAGE is required only when
HUGETLB_PAGE_OPTIMIZE_VMEMMAP is enabled. Hence BUG_ON() trigger should
happen only when applicable.
Cc: Muchun Song <muchun.song@...ux.dev>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
---
This patch applies on v6.13-rc1
mm/hugetlb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ea2ed8e301ef..b7443c7f3e0c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4513,11 +4513,13 @@ void __init hugetlb_add_hstate(unsigned int order)
struct hstate *h;
unsigned long i;
- if (size_to_hstate(PAGE_SIZE << order)) {
+ if (size_to_hstate(PAGE_SIZE << order))
return;
- }
+
BUG_ON(hugetlb_max_hstate >= HUGE_MAX_HSTATE);
+#ifdef HUGETLB_PAGE_OPTIMIZE_VMEMMAP
BUG_ON(order < order_base_2(__NR_USED_SUBPAGE));
+#endif
h = &hstates[hugetlb_max_hstate++];
__mutex_init(&h->resize_lock, "resize mutex", &h->resize_key);
h->order = order;
--
2.30.2
Powered by blists - more mailing lists