Commit 6963f008 authored by Miao Wang's avatar Miao Wang Committed by Andrew Morton

mm: vmalloc: add optimization hint on page existence check

In commit 21e516b9 ("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.

Link: https://lkml.kernel.org/r/20240814-fix_vmap_unlikely-v1-1-cd7954775f12@gmail.com
Fixes: 21e516b9 ("mm: vmalloc: dump page owner info if page is already mapped")
Signed-off-by: default avatarMiao Wang <shankerwangmiao@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hariom Panthi <hariom1.p@samsung.com>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 59149bf8
...@@ -105,7 +105,7 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, ...@@ -105,7 +105,7 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
if (!pte) if (!pte)
return -ENOMEM; return -ENOMEM;
do { do {
if (!pte_none(ptep_get(pte))) { if (unlikely(!pte_none(ptep_get(pte)))) {
if (pfn_valid(pfn)) { if (pfn_valid(pfn)) {
page = pfn_to_page(pfn); page = pfn_to_page(pfn);
dump_page(page, "remapping already mapped page"); dump_page(page, "remapping already mapped page");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment