Skip to contentSkip to conversation

mm/page_alloc: remove VM_BUG_ON()s from pindex helpers

PATCH In review Brendan Jackman 3 participants 3 messages May 26 – Jun 17

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mm/page_alloc: remove VM_BUG_ON()s from pindex helpers

Vlastimil pointed out that the VM_BUG_ON()s have fallen out of favour, so remove them.

---
Changes in v2:
- Rebased onto mm-new, removed VM_BUG_ON()s
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 mm/page_alloc.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
mm/page_alloc.c +1 -8
index 1b5b1e556f76feadf21f3f44a9440fe883fb7651..e47679e7a9dbc772aa27f550a10aa8c0e95af55a 100644
@@ -653,13 +653,8 @@ static inline unsigned int order_to_pindex(int migratetype, int order)
 	if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
 		bool movable = migratetype == MIGRATE_MOVABLE;
 
-		if (order > PAGE_ALLOC_COSTLY_ORDER) {
-			VM_BUG_ON(!is_pmd_order(order));
-
+		if (order > PAGE_ALLOC_COSTLY_ORDER)
 			return NR_LOWORDER_PCP_LISTS + movable;
-		}
-	} else {
-		VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
 	}
 
 	return (MIGRATE_PCPTYPES * order) + migratetype;
@@ -672,8 +667,6 @@ static inline int pindex_to_order(unsigned int pindex)
 	if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
 		if (pindex >= NR_LOWORDER_PCP_LISTS)
 			order = HPAGE_PMD_ORDER;
-	} else {
-		VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
 	}
 
 	return order;

---
base-commit: da0a06486ac3ce47c6ffb603d2fd332229d41592
change-id: 20260512-page_alloc-unmapped-prep-c3ae0381d58b

Best regards,

Signature · 1 line
Brendan Jackman <[email protected]>
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Brendan Jackman

Vlastimil pointed out that the VM_BUG_ON()s have fallen out of favour, so remove them.

Thanks.

Quoted 42 lines

---
Changes in v2:
- Rebased onto mm-new, removed VM_BUG_ON()s
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 mm/page_alloc.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
mm/page_alloc.c +1 -9
index 1b5b1e556f76feadf21f3f44a9440fe883fb7651..e47679e7a9dbc772aa27f550a10aa8c0e95af55a 100644
@@ -653,13 +653,8 @@ static inline unsigned int order_to_pindex(int migratetype, int order)
 	if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
 		bool movable = migratetype == MIGRATE_MOVABLE;
 
-		if (order > PAGE_ALLOC_COSTLY_ORDER) {
-			VM_BUG_ON(!is_pmd_order(order));
-
+		if (order > PAGE_ALLOC_COSTLY_ORDER)
 			return NR_LOWORDER_PCP_LISTS + movable;
-		}
-	} else {
-		VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
 	}
 
 	return (MIGRATE_PCPTYPES * order) + migratetype;
@@ -672,8 +667,6 @@ static inline int pindex_to_order(unsigned int pindex)
 	if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
 		if (pindex >= NR_LOWORDER_PCP_LISTS)
 			order = HPAGE_PMD_ORDER;
-	} else {
-		VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
 	}
 
 	return order;
 
---

base-commit: da0a06486ac3ce47c6ffb603d2fd332229d41592
change-id: 20260512-page_alloc-unmapped-prep-c3ae0381d58b

Best regards,