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