All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm/pti: in pti_clone_pgtable() don't increase addr by PUD_SIZE
@ 2019-08-20  7:51 Song Liu
  2019-08-20  9:12   ` Thomas Gleixner
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Song Liu @ 2019-08-20  7:51 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: kernel-team, Song Liu, stable, Joerg Roedel, Thomas Gleixner,
	Dave Hansen, Andy Lutomirski, Peter Zijlstra

pti_clone_pgtable() increases addr by PUD_SIZE for pud_none(*pud) case.
This is not accurate because addr may not be PUD_SIZE aligned.

In our x86_64 kernel, pti_clone_pgtable() fails to clone 7 PMDs because
of this issuse, including PMD for the irq entry table. For a memcache
like workload, this introduces about 4.5x more iTLB-load and about 2.5x
more iTLB-load-misses on a Skylake CPU.

This patch fixes this issue by adding PMD_SIZE to addr for pud_none()
case.

Cc: stable@vger.kernel.org # v4.19+
Fixes: 16a3fe634f6a ("x86/mm/pti: Clone kernel-image on PTE level for 32 bit")
Signed-off-by: Song Liu <songliubraving@fb.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 arch/x86/mm/pti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index b196524759ec..5a67c3015f59 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -330,7 +330,7 @@ pti_clone_pgtable(unsigned long start, unsigned long end,
 
 		pud = pud_offset(p4d, addr);
 		if (pud_none(*pud)) {
-			addr += PUD_SIZE;
+			addr += PMD_SIZE;
 			continue;
 		}
 
-- 
2.17.1


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

end of thread, other threads:[~2019-08-20 16:56 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20  7:51 [PATCH] x86/mm/pti: in pti_clone_pgtable() don't increase addr by PUD_SIZE Song Liu
2019-08-20  9:12 ` Thomas Gleixner
2019-08-20  9:12   ` Thomas Gleixner
2019-08-20 13:17   ` Song Liu
2019-08-20 10:00 ` Peter Zijlstra
2019-08-20 11:16   ` Thomas Gleixner
2019-08-20 11:16     ` Thomas Gleixner
2019-08-20 13:21     ` Song Liu
2019-08-20 13:39       ` Thomas Gleixner
2019-08-20 13:39         ` Thomas Gleixner
2019-08-20 13:55       ` Rik van Riel
2019-08-20 14:00         ` Song Liu
2019-08-20 16:56           ` [PATCH v2] " Rik van Riel
2019-08-20 16:56             ` Rik van Riel
2019-08-20 13:21     ` [PATCH] " Rik van Riel
2019-08-20 13:19   ` Song Liu
2019-08-20 13:57 ` Dave Hansen
2019-08-20 14:14   ` Song Liu
2019-08-20 14:18     ` Dave Hansen
2019-08-20 16:05       ` Song Liu
2019-08-20 16:38         ` Song Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.