public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] x86: Align TLB invalidation info
@ 2018-01-31 21:19 Nadav Amit
  2018-02-13 15:29 ` [tip:x86/mm] x86/mm: " tip-bot for Nadav Amit
  0 siblings, 1 reply; 2+ messages in thread
From: Nadav Amit @ 2018-01-31 21:19 UTC (permalink / raw)
  To: x86
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, linux-kernel,
	Peter Zijlstra, Nadav Amit, Nadav Amit, Andy Lutomirski,
	Dave Hansen

The TLB invalidation info is allocated on the stack, which might cause
it to be unaligned. Since this information may be transferred to
different cores for TLB shootdown, this may cause an additional cache
line to become shared. While the overhead is likely to be small, the
fix is simple.

We do not use __cacheline_aligned() since it also defines the section,
which is inappropriate for stack variables.

Signed-off-by: Nadav Amit <namit@vmware.com>
Acked-by: Andy Lutomirski <luto@kernel.org>

Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>

--
v2 -> v3: rewording the commit message (Andy)
v1 -> v2: use __aligned instead of all the mess (Andy)
---
 arch/x86/mm/tlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 5bfe61a5e8e3..9690112e3a82 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -576,7 +576,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
 {
 	int cpu;
 
-	struct flush_tlb_info info = {
+	struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = {
 		.mm = mm,
 	};
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:x86/mm] x86/mm: Align TLB invalidation info
  2018-01-31 21:19 [PATCH v3] x86: Align TLB invalidation info Nadav Amit
@ 2018-02-13 15:29 ` tip-bot for Nadav Amit
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Nadav Amit @ 2018-02-13 15:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: luto, torvalds, dave.hansen, nadav.amit, linux-kernel, tglx,
	peterz, namit, mingo, hpa

Commit-ID:  515ab7c41306aad1f80a980e1936ef635c61570c
Gitweb:     https://git.kernel.org/tip/515ab7c41306aad1f80a980e1936ef635c61570c
Author:     Nadav Amit <namit@vmware.com>
AuthorDate: Wed, 31 Jan 2018 13:19:12 -0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 13 Feb 2018 15:05:49 +0100

x86/mm: Align TLB invalidation info

The TLB invalidation info is allocated on the stack, which might cause
it to be unaligned. Since this information may be transferred to
different cores for TLB shootdown, this may cause an additional cache
line to become shared. While the overhead is likely to be small, the
fix is simple.

We do not use __cacheline_aligned() since it also defines the section,
which is inappropriate for stack variables.

Signed-off-by: Nadav Amit <namit@vmware.com>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180131211912.52064-1-namit@vmware.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/mm/tlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 8dcc060..6550d37 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -613,7 +613,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
 {
 	int cpu;
 
-	struct flush_tlb_info info = {
+	struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = {
 		.mm = mm,
 	};
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-13 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-31 21:19 [PATCH v3] x86: Align TLB invalidation info Nadav Amit
2018-02-13 15:29 ` [tip:x86/mm] x86/mm: " tip-bot for Nadav Amit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox