linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miao Wang via B4 Relay <devnull+shankerwangmiao.gmail.com@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	 Uladzislau Rezki <urezki@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	 Hariom Panthi <hariom1.p@samsung.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Miao Wang <shankerwangmiao@gmail.com>
Subject: [PATCH] mm: vmalloc: add optimization hint on page existence check
Date: Wed, 14 Aug 2024 01:12:13 +0800	[thread overview]
Message-ID: <20240814-fix_vmap_unlikely-v1-1-cd7954775f12@gmail.com> (raw)

From: Miao Wang <shankerwangmiao@gmail.com>

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")
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
---
 mm/vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 6b783baf12a1..5d031fc83f04 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -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,
-- 
Miao Wang <shankerwangmiao@gmail.com>




                 reply	other threads:[~2024-08-13 17:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240814-fix_vmap_unlikely-v1-1-cd7954775f12@gmail.com \
    --to=devnull+shankerwangmiao.gmail.com@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hariom1.p@samsung.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shankerwangmiao@gmail.com \
    --cc=urezki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox