Skip to contentSkip to conversation

mm: vmalloc: add optimization hint on page existence check

PATCH Applied Miao Wang 1 participant 1 message Aug 13, 2024

Subsystems (2)
lore
Share & tools
lore

Miao Wang

author
#0 lore raw

PATCH 1/1 mm: vmalloc: add optimization hint on page existence check

In commit 21e516b913c1 ("mm: vmalloc: dump page owner info if page is already mapped"), a BUG_ON macro was changed into an if statement, where the compiler optimization hint introduced in the BUG_ON macro was removed along with this change. This patch adds back the hint.

Fixes 21e516b913c1 ("mm: vmalloc: dump page owner info if page is already mapped")
---
 mm/vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmalloc.c +1 -1
index 6b783baf12a1..5d031fc83f04 100644
@@ -105,7 +105,7 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 	if (!pte)
 		return -ENOMEM;
 	do {
-		if (!pte_none(ptep_get(pte))) {
+		if (unlikely(!pte_none(ptep_get(pte)))) {
 			if (pfn_valid(pfn)) {
 				page = pfn_to_page(pfn);
 				dump_page(page, "remapping already mapped page");

---
base-commit: 7c626ce4bae1ac14f60076d00eafe71af30450ba
change-id: 20240814-fix_vmap_unlikely-2973d2cb904b

Best regards,

Signature · 1 line
Miao Wang <[email protected]>