From: "Tiwei Bie" <tiwei.btw@antgroup.com>
To: richard@nod.at, anton.ivanov@cambridgegreys.com,
johannes@sipsolutions.net
Cc: <linux-um@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
"Tiwei Bie" <tiwei.btw@antgroup.com>
Subject: [PATCH 2/6] um: Remove the redundant newpage check in update_pte_range
Date: Fri, 16 Aug 2024 09:54:43 +0800 [thread overview]
Message-ID: <20240816015447.320394-3-tiwei.btw@antgroup.com> (raw)
In-Reply-To: <20240816015447.320394-1-tiwei.btw@antgroup.com>
The two checks have been identical since commit ef714f15027c ("um:
remove force_flush_all from fork_handler"). And the inner one isn't
necessary anymore.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/kernel/tlb.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 44c6fc697f3a..dddbc473baa7 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -82,16 +82,13 @@ static inline int update_pte_range(pmd_t *pmd, unsigned long addr,
(x ? UM_PROT_EXEC : 0));
if (pte_newpage(*pte)) {
if (pte_present(*pte)) {
- if (pte_newpage(*pte)) {
- __u64 offset;
- unsigned long phys =
- pte_val(*pte) & PAGE_MASK;
- int fd = phys_mapping(phys, &offset);
-
- ret = ops->mmap(ops->mm_idp, addr,
- PAGE_SIZE, prot, fd,
- offset);
- }
+ __u64 offset;
+ unsigned long phys = pte_val(*pte) & PAGE_MASK;
+ int fd = phys_mapping(phys, &offset);
+
+ ret = ops->mmap(ops->mm_idp, addr,
+ PAGE_SIZE, prot, fd,
+ offset);
} else
ret = ops->unmap(ops->mm_idp, addr, PAGE_SIZE);
} else if (pte_newprot(*pte))
--
2.34.1
next prev parent reply other threads:[~2024-08-16 2:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
2024-08-16 1:54 ` [PATCH 1/6] um: Remove unused kpte_clear_flush macro Tiwei Bie
2024-08-16 1:54 ` Tiwei Bie [this message]
2024-08-16 1:54 ` [PATCH 3/6] um: Remove unused fields from thread_struct Tiwei Bie
2024-08-16 1:54 ` [PATCH 4/6] um: Remove unused mm_fd field from mm_id Tiwei Bie
2024-08-16 5:59 ` Benjamin Berg
2024-08-16 7:58 ` Tiwei Bie
2024-08-16 1:54 ` [PATCH 5/6] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
2024-08-16 1:54 ` [PATCH 6/6] um: Remove declarations of undefined functions Tiwei Bie
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=20240816015447.320394-3-tiwei.btw@antgroup.com \
--to=tiwei.btw@antgroup.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
/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