ANDROID: GKI: add a vendor hook in ptep_clear_flush_young()

Add a vendor hook to be able to skip ptep tlb flush.

Bug: 312692863
Test: boot
Change-Id: Ifbc7a52111616d0542b866532a9bf82368e6c8f1
Signed-off-by: Martin Liu <liumartin@google.com>
This commit is contained in:
Martin Liu
2023-11-30 11:00:56 +08:00
committed by Treehugger Robot
parent 0add0e52ef
commit 46f8b2ca58
4 changed files with 17 additions and 1 deletions

View File

@@ -843,12 +843,14 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
}
#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
extern bool should_flush_tlb_when_young(void);
static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
unsigned long address, pte_t *ptep)
{
int young = ptep_test_and_clear_young(vma, address, ptep);
if (young) {
if (young && should_flush_tlb_when_young()) {
/*
* We can elide the trailing DSB here since the worst that can
* happen is that a CPU continues to use the young entry in its

View File

@@ -38,6 +38,8 @@
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>
#include <trace/hooks/mm.h>
#define NO_BLOCK_MAPPINGS BIT(0)
#define NO_CONT_MAPPINGS BIT(1)
#define NO_EXEC_MAPPINGS BIT(2) /* assumes FEAT_HPDS is not used */
@@ -1491,6 +1493,14 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr)
return 1;
}
bool should_flush_tlb_when_young(void)
{
bool skip = false;
trace_android_vh_ptep_clear_flush_young(&skip);
return !skip;
}
#ifdef CONFIG_MEMORY_HOTPLUG
static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size)
{

View File

@@ -373,3 +373,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_buf);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_isolate_freepages);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_thermal_stats);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptep_clear_flush_young);

View File

@@ -171,6 +171,9 @@ DECLARE_HOOK(android_vh_alloc_pages_entry,
DECLARE_HOOK(android_vh_isolate_freepages,
TP_PROTO(struct compact_control *cc, struct page *page, bool *bypass),
TP_ARGS(cc, page, bypass));
DECLARE_HOOK(android_vh_ptep_clear_flush_young,
TP_PROTO(bool *skip),
TP_ARGS(skip));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */