From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: catalin.marinas@arm.com, will@kernel.org
Cc: anshuman.khandual@arm.com, mike.kravetz@oracle.com,
songmuchun@bytedance.com, baolin.wang@linux.alibaba.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [RESEND PATCH] arm64/hugetlb: Simplify the huge_ptep_set_access_flags()
Date: Wed, 8 Jun 2022 16:04:09 +0800 [thread overview]
Message-ID: <bd98f6a8fbfe10571cae2d62b26f8630e5285833.1654674894.git.baolin.wang@linux.alibaba.com> (raw)
After commit bc5dfb4fd7bd ("arm64/hugetlb: Implement arm64 specific
huge_ptep_get()"), the arm64 specific huge_ptep_get() will always
consider the subpages' dirty and young state for CONT-PTE/PMD hugetlb.
Thus there is no need to check them again when setting the access flags
for CONT-PTE/PMD hugetlb in huge_ptep_set_access_flags(), since the
original pte value already considered the subpages' dirty and young
state by huge_ptep_get().
Meanwhile this also fixes an issue when users want to make the CONT-PTE/PMD
hugetlb's pte entry old, which will be failed to make the pte entry old
since the original code will always consider the subpages' young state
if the subpages' young state is set. For example, we will make the
CONT-PTE/PMD hugetlb pte entry old in DAMON to monitoring the accesses,
but we'll be failed to monitoring the actual accesses of the CONT-PTE/PMD
hugetlb page, due to we can not make its pte old if some subpages are
accessing.
Thus remove the code considering the subpages' dirty and young state in
huge_ptep_set_access_flags() to fix this issue and simplify the function.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
arch/arm64/mm/hugetlbpage.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index e2a5ec9..5c703aa 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -448,7 +448,6 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
size_t pgsize = 0;
unsigned long pfn = pte_pfn(pte), dpfn;
pgprot_t hugeprot;
- pte_t orig_pte;
if (!pte_cont(pte))
return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
@@ -459,14 +458,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
if (!__cont_access_flags_changed(ptep, pte, ncontig))
return 0;
- orig_pte = get_clear_contig(vma->vm_mm, addr, ptep, pgsize, ncontig);
-
- /* Make sure we don't lose the dirty or young state */
- if (pte_dirty(orig_pte))
- pte = pte_mkdirty(pte);
-
- if (pte_young(orig_pte))
- pte = pte_mkyoung(pte);
+ clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig);
hugeprot = pte_pgprot(pte);
for (i = 0; i < ncontig; i++, ptep++, addr += pgsize, pfn += dpfn)
--
1.8.3.1
reply other threads:[~2022-06-08 8:04 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=bd98f6a8fbfe10571cae2d62b26f8630e5285833.1654674894.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=songmuchun@bytedance.com \
--cc=will@kernel.org \
/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