From f7c932399ef129df1ab7ff55eadaa5139a1c5be3 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Tue, 28 Jun 2022 14:07:25 +0800 Subject: [PATCH] ANDROID: vendor_hook: Add hook in handle_pte_fault() android_vh_handle_pte_fault_end: after handle_pte_fault, update the information that whether this page need to be reclaimed to a swap location. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I0ceb02422fc858ed96fbb47e220bf96bdc8fa68c --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/memory.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 956e8594bf3d..c0855cc0692e 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -407,6 +407,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_tlb_conf); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_pte_fault_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 6b4d778ad2de..3d4bcd79cd34 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -149,6 +149,9 @@ DECLARE_HOOK(android_vh_subpage_dma_contig_alloc, DECLARE_HOOK(android_vh_ra_tuning_max_page, TP_PROTO(struct readahead_control *ractl, unsigned long *max_page), TP_ARGS(ractl, max_page)); +DECLARE_HOOK(android_vh_handle_pte_fault_end, + TP_PROTO(struct vm_fault *vmf, unsigned long highest_memmap_pfn), + TP_ARGS(vmf, highest_memmap_pfn)); DECLARE_HOOK(android_vh_cow_user_page, TP_PROTO(struct vm_fault *vmf, struct page *page), TP_ARGS(vmf, page)); diff --git a/mm/memory.c b/mm/memory.c index 6ba58a781626..7d70acf494d4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4763,6 +4763,7 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf) if (vmf->flags & FAULT_FLAG_WRITE) flush_tlb_fix_spurious_fault(vmf->vma, vmf->address); } + trace_android_vh_handle_pte_fault_end(vmf, highest_memmap_pfn); unlock: pte_unmap_unlock(vmf->pte, vmf->ptl); return ret;