Skip to contentSkip to conversation

kasan-call-clear_page-with-a-match-all-tag-instead-of-changing-page-tag.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 28, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kasan: call clear_page with a match-all tag instead of changing page tag
has been removed from the -mm tree. Its filename was
kasan-call-clear_page-with-a-match-all-tag-instead-of-changing-page-tag.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Peter Collingbourne <[email protected]>
Subject: kasan: call clear_page with a match-all tag instead of changing page tag
Date: Thu, 16 Feb 2023 11:59:24 -0800

Instead of changing the page's tag solely in order to obtain a pointer with a match-all tag and then changing it back again, just convert the pointer that we get from kmap_atomic() into one with a match-all tag before passing it to clear_page().

On a certain microarchitecture, this has been observed to cause a measurable improvement in microbenchmark performance, presumably as a result of being able to avoid the atomic operations on the page tag.

---

 include/linux/highmem.h |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
include/linux/highmem.h renamed from include/linux/highmem.h~kasan-call-clear_page-with-a-match-all-tag-instead-of-changing-page-tag +3 -5
@@ -243,12 +243,10 @@ static inline void clear_highpage(struct
 
 static inline void clear_highpage_kasan_tagged(struct page *page)
 {
-	u8 tag;
+	void *kaddr = kmap_local_page(page);
 
-	tag = page_kasan_tag(page);
-	page_kasan_tag_reset(page);
-	clear_highpage(page);
-	page_kasan_tag_set(page, tag);
+	clear_page(kasan_reset_tag(kaddr));
+	kunmap_local(kaddr);
 }
 
 #ifndef __HAVE_ARCH_TAG_CLEAR_HIGHPAGE

_

Patches currently in -mm which might be from [email protected] are