ANDROID: vendor hook for TLB batching control

Add vendor hook for flushing TLB batching in zap_pte_range.

Bug: 238728493
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: If2de5f070dd7b76624961f5a91440bf69a99ca2d
This commit is contained in:
Minchan Kim
2022-10-19 08:25:34 -07:00
parent 2823b3889d
commit d257ef6764
3 changed files with 17 additions and 1 deletions

View File

@@ -282,6 +282,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_from_fragment_pool);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exclude_reserved_zone);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_include_reserved_zone);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zap_pte_range_tlb_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zap_pte_range_tlb_force_flush);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zap_pte_range_tlb_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_adjust);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_mem);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_print_slabinfo_header);

View File

@@ -100,6 +100,15 @@ DECLARE_HOOK(android_vh_alloc_pages_slowpath,
DECLARE_HOOK(android_vh_cma_alloc_adjust,
TP_PROTO(struct zone *zone, bool *is_cma_alloc),
TP_ARGS(zone, is_cma_alloc));
DECLARE_HOOK(android_vh_zap_pte_range_tlb_start,
TP_PROTO(void *unused),
TP_ARGS(unused));
DECLARE_HOOK(android_vh_zap_pte_range_tlb_force_flush,
TP_PROTO(struct page *page, bool *flush),
TP_ARGS(page, flush));
DECLARE_HOOK(android_vh_zap_pte_range_tlb_end,
TP_PROTO(void *unused),
TP_ARGS(unused));
DECLARE_HOOK(android_vh_print_slabinfo_header,
TP_PROTO(struct seq_file *m),
TP_ARGS(m));

View File

@@ -1233,12 +1233,14 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
tlb_change_page_size(tlb, PAGE_SIZE);
again:
trace_android_vh_zap_pte_range_tlb_start(NULL);
init_rss_vec(rss);
start_pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
pte = start_pte;
flush_tlb_batched_pending(mm);
arch_enter_lazy_mmu_mode();
do {
bool flush = false;
pte_t ptent = *pte;
if (pte_none(ptent))
continue;
@@ -1279,8 +1281,9 @@ again:
page_remove_rmap(page, false);
if (unlikely(page_mapcount(page) < 0))
print_bad_pte(vma, addr, ptent, page);
trace_android_vh_zap_pte_range_tlb_force_flush(page, &flush);
if (unlikely(__tlb_remove_page(tlb, page)) ||
lru_cache_disabled()) {
lru_cache_disabled() || flush) {
force_flush = 1;
addr += PAGE_SIZE;
break;
@@ -1346,6 +1349,7 @@ again:
tlb_flush_mmu(tlb);
}
trace_android_vh_zap_pte_range_tlb_end(NULL);
if (addr != end) {
cond_resched();
goto again;