[PATCH 1/2] arm64: mte: use a folio in __access_remote_tags()
Tal Zussman
tz2294 at columbia.edu
Sat Oct 31 13:44:53 PDT 2026
__access_remote_tags() looks up the folio for the hugetlb check but
still uses the page everywhere else it can use the folio. Use the folio
for the rest, which removes the hidden compound_head() calls.
This removes the last use of set_page_dirty_lock() in arm64.
Signed-off-by: Tal Zussman <tz2294 at columbia.edu>
---
arch/arm64/kernel/mte.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
index 31f5c6b0510e..f8d39e70857e 100644
--- a/arch/arm64/kernel/mte.c
+++ b/arch/arm64/kernel/mte.c
@@ -467,6 +467,7 @@ static int __access_remote_tags(struct mm_struct *mm, unsigned long addr,
err = PTR_ERR(page);
break;
}
+ folio = page_folio(page);
/*
* Only copy tags if the page has been mapped as PROT_MTE
@@ -477,16 +478,15 @@ static int __access_remote_tags(struct mm_struct *mm, unsigned long addr,
*/
if (!(vma->vm_flags & VM_MTE)) {
err = -EIO;
- put_page(page);
+ folio_put(folio);
break;
}
- folio = page_folio(page);
if (folio_test_hugetlb(folio))
WARN_ON_ONCE(!folio_test_hugetlb_mte_tagged(folio) &&
!is_huge_zero_folio(folio));
else
- WARN_ON_ONCE(!page_mte_tagged(page) && !is_zero_page(page));
+ WARN_ON_ONCE(!page_mte_tagged(page) && !is_zero_folio(folio));
/* limit access to the end of the page */
offset = offset_in_page(addr);
@@ -495,11 +495,11 @@ static int __access_remote_tags(struct mm_struct *mm, unsigned long addr,
maddr = page_address(page);
if (write) {
tags = mte_copy_tags_from_user(maddr + offset, buf, tags);
- set_page_dirty_lock(page);
+ folio_mark_dirty_lock(folio);
} else {
tags = mte_copy_tags_to_user(buf, maddr + offset, tags);
}
- put_page(page);
+ folio_put(folio);
/* error accessing the tracer's buffer */
if (!tags)
--
2.39.5
More information about the linux-arm-kernel
mailing list