Skip to contentSkip to conversation

mm/hugetlb: Make __NR_USED_SUBPAGE check conditional

PATCH Superseded Anshuman Khandual 2 participants 2 messages Dec 2, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
This patch applies on v6.13-rc1

 mm/hugetlb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
mm/hugetlb.c +4 -2
index ea2ed8e301ef..b7443c7f3e0c 100644
@@ -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;
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 10 lines · Anshuman Khandual

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.

---

...

mm/hugetlb.c void __init hugetlb_add_hstate(unsigned int order) · line 4520

Quoted 3 lines
mm/hugetlb.c +2 -0
+
 	BUG_ON(hugetlb_max_hstate >= HUGE_MAX_HSTATE);
+#ifdef HUGETLB_PAGE_OPTIMIZE_VMEMMAP

#ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP ?

Signature · 2 lines
Oscar Salvador
SUSE Labs