linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc: Fix regression caused by needless vmalloc_sync_all()
@ 2019-11-13  9:55 Shile Zhang
  2019-11-13 15:17 ` Qian Cai
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Shile Zhang @ 2019-11-13  9:55 UTC (permalink / raw)
  To: Andrew Morton, Joerg Roedel; +Cc: linux-mm, linux-kbuild, Shile Zhang

vmalloc_sync_all() was put in the common path in
__purge_vmap_area_lazy(), for one sync issue only happened on X86_32
with PTI enabled. It is needless for X86_64, which caused a big regression
in UnixBench Shell8 testing on X86_64.
Similar regression also reported by 0-day kernel test robot in reaim
benchmarking:
https://lists.01.org/hyperkitty/list/lkp@lists.01.org/thread/4D3JPPHBNOSPFK2KEPC6KGKS6J25AIDB/

Fix it by adding more conditions.

Fixes: 3f8fd02b1bf1 ("mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy()")

Signed-off-by: Shile Zhang <shile.zhang@linux.alibaba.com>
---
 mm/vmalloc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index a3c70e275f4e..7b9fc7966da6 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1255,11 +1255,17 @@ static bool __purge_vmap_area_lazy(unsigned long start, unsigned long end)
 	if (unlikely(valist == NULL))
 		return false;
 
+#if defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE)
 	/*
 	 * First make sure the mappings are removed from all page-tables
 	 * before they are freed.
+	 *
+	 * This is only needed on x86-32 with !SHARED_KERNEL_PMD, which is
+	 * the case on a PAE kernel with PTI enabled.
 	 */
-	vmalloc_sync_all();
+	if (!SHARED_KERNEL_PMD && boot_cpu_has(X86_FEATURE_PTI))
+		vmalloc_sync_all();
+#endif
 
 	/*
 	 * TODO: to calculate a flush range without looping.
-- 
2.24.0.rc2



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

end of thread, other threads:[~2019-11-16 17:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13  9:55 [PATCH] mm/vmalloc: Fix regression caused by needless vmalloc_sync_all() Shile Zhang
2019-11-13 15:17 ` Qian Cai
2019-11-13 21:12 ` Andrew Morton
2019-11-14  0:54   ` Shile Zhang
2019-11-14 13:56 ` Michal Hocko
2019-11-14 14:40   ` Shile Zhang
2019-11-14 17:14     ` Joerg Roedel
2019-11-14 17:12 ` Joerg Roedel
2019-11-15  0:01   ` Andrew Morton
2019-11-15  8:38     ` Borislav Petkov
2019-11-15 23:37       ` Andrew Morton
2019-11-16 17:38         ` Borislav Petkov
2019-11-15  1:06   ` Shile Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).