[PATCH 3/3] mm: skip page_cpupid_reset_last atomic update if the value is already reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Improves performance of a PROT_READ -> PROT_READ|PROT_WRITE -> store
microbenchmark (which goes via the wp_page_reuse fault path) by about
10% on a POWER9.

Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx>
---
 include/linux/mm.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6ece500464e0..c0a9e8de0738 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1382,6 +1382,9 @@ static inline void __page_cpupid_reset_last(struct page *page)
 
 static inline void page_cpupid_reset_last(struct page *page)
 {
+	if (page_cpupid_last(page) == (-1 & LAST_CPUPID_MASK))
+		return;
+
 	page_cpupid_xchg_last(page, (1 << LAST_CPUPID_SHIFT) - 1);
 }
 
-- 
2.23.0





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux