From: I Hsin Cheng <richard120310@gmail.com>
To: akpm@linux-foundation.org
Cc: zhengqi.arch@bytedance.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, jserv@ccns.ncku.edu.tw,
I Hsin Cheng <richard120310@gmail.com>
Subject: [PATCH] mm: pgtable: Unlock pml without branches when !start_pte
Date: Mon, 10 Feb 2025 18:09:48 +0800 [thread overview]
Message-ID: <20250210100948.312130-1-richard120310@gmail.com> (raw)
When !start_pte is true, the branch for "start_pte" in "out_ptl" label
section is surely false, and "ptl != pml" must be true since "ptl" is
NULL in this case.
It means both branches in "out_ptl" are redundant, only one thing to be
done is to unlock "pml", make it directly unlock "pml" and return in
this case.
Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
---
mm/pt_reclaim.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/pt_reclaim.c b/mm/pt_reclaim.c
index 7e9455a18aae..f5d5c42a4679 100644
--- a/mm/pt_reclaim.c
+++ b/mm/pt_reclaim.c
@@ -42,8 +42,10 @@ void try_to_free_pte(struct mm_struct *mm, pmd_t *pmd, unsigned long addr,
pml = pmd_lock(mm, pmd);
start_pte = pte_offset_map_rw_nolock(mm, pmd, addr, &pmdval, &ptl);
- if (!start_pte)
- goto out_ptl;
+ if (!start_pte) {
+ spin_unlock(pml);
+ return;
+ }
if (ptl != pml)
spin_lock_nested(ptl, SINGLE_DEPTH_NESTING);
--
2.43.0
next reply other threads:[~2025-02-10 10:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 10:09 I Hsin Cheng [this message]
2025-02-11 0:37 ` Andrew Morton
2025-02-11 6:49 ` I Hsin Cheng
2025-02-11 23:50 ` Andrew Morton
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=20250210100948.312130-1-richard120310@gmail.com \
--to=richard120310@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=zhengqi.arch@bytedance.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