[tip:,x86/mm] x86/mm/tlb: Do not make is_lazy dirty for no reason
diff mbox series

Message ID 161467888727.20312.2951422825515894606.tip-bot2@tip-bot2
State In Next
Commit db73f8099a502be8ed46f6332c91754c74ac76c2
Headers show
Series
  • [tip:,x86/mm] x86/mm/tlb: Do not make is_lazy dirty for no reason
Related show

Commit Message

tip-bot2 for Wei Yongjun March 2, 2021, 9:54 a.m. UTC
The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     db73f8099a502be8ed46f6332c91754c74ac76c2
Gitweb:        https://git.kernel.org/tip/db73f8099a502be8ed46f6332c91754c74ac76c2
Author:        Nadav Amit <namit@vmware.com>
AuthorDate:    Sat, 20 Feb 2021 15:17:09 -08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 02 Mar 2021 08:01:38 +01:00

x86/mm/tlb: Do not make is_lazy dirty for no reason

Blindly writing to is_lazy for no reason, when the written value is
identical to the old value, makes the cacheline dirty for no reason.
Avoid making such writes to prevent cache coherency traffic for no
reason.

Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/r/20210220231712.2475218-7-namit@vmware.com
---
 arch/x86/mm/tlb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 345a0af..17ec4bf 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -469,7 +469,8 @@  void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
 		__flush_tlb_all();
 	}
 #endif
-	this_cpu_write(cpu_tlbstate_shared.is_lazy, false);
+	if (was_lazy)
+		this_cpu_write(cpu_tlbstate_shared.is_lazy, false);
 
 	/*
 	 * The membarrier system call requires a full memory barrier and