Re: [PATCH 1/1] mm/vmalloc: Combine all TLB flush operations of KASAN shadow virtual address into one operation

From: Baoquan He
Date: Mon Jul 29 2024 - 04:30:58 EST


On 07/27/24 at 12:52am, Adrian Huang wrote:
......
> If we combine all TLB flush operations of the KASAN shadow virtual
> address into one operation in the call path
> 'purge_vmap_node()->kasan_release_vmalloc()', the running time of
> drain_vmap_area_work() can be saved greatly. The idea is from the
> flush_tlb_kernel_range() call in __purge_vmap_area_lazy(). And, the
> soft lockup won't not be triggered.
~~~~~~~~~~~
typo
>
> Here is the test result based on 6.10:
>
> [6.10 wo/ the patch]
> 1. ftrace latency profiling (record a trace if the latency > 20s).
> echo 20000000 > /sys/kernel/debug/tracing/tracing_thresh
> echo drain_vmap_area_work > /sys/kernel/debug/tracing/set_graph_function
> echo function_graph > /sys/kernel/debug/tracing/current_tracer
> echo 1 > /sys/kernel/debug/tracing/tracing_on
>
......
> The worst execution time of drain_vmap_area_work() is about 1 second.
>
> Link: https://lore.kernel.org/lkml/ZqFlawuVnOMY2k3E@xxxxxxxxx/
> Fixes: 282631cb2447 ("mm: vmalloc: remove global purge_vmap_area_root rb-tree")
> Signed-off-by: Adrian Huang <ahuang12@xxxxxxxxxx>
> Co-developed-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
> Tested-by: Jiwei Sun <sunjw10@xxxxxxxxxx>
> ---
> include/linux/kasan.h | 12 +++++++++---
> mm/kasan/shadow.c | 14 ++++++++++----
> mm/vmalloc.c | 34 ++++++++++++++++++++++++++--------
> 3 files changed, 45 insertions(+), 15 deletions(-)

LGTM,

Reviewed-by: Baoquan He <bhe@xxxxxxxxxx>