ANDROID: mm: Add vendor hook to trace wp_page_reuse

Add a hook for custom vendor modules to trace wp_page_reuse behavior,
This allows for monitoring of page reuse events and custom handling.

Bug: 437042547
Change-Id: I0faf068acdff2f964884d3081c35d85abd5a19fa
Signed-off-by: Tangquan Zheng <zhengtangquan@oppo.com>
This commit is contained in:
Tangquan Zheng
2025-08-07 19:23:05 +08:00
committed by Treehugger Robot
parent 47cca68200
commit 7356f4dbc5
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -460,6 +460,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_split_large_folio_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_should_be_protected);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_check_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_read_fault);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_wp_page_reuse);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_read);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_map_pages);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_try_alloc_pages_gfp);
+3
View File
@@ -371,6 +371,9 @@ DECLARE_HOOK(android_vh_page_should_be_protected,
DECLARE_HOOK(android_vh_do_read_fault,
TP_PROTO(struct vm_fault *vmf, unsigned long fault_around_bytes),
TP_ARGS(vmf, fault_around_bytes));
DECLARE_HOOK(android_vh_wp_page_reuse,
TP_PROTO(struct vm_fault *vmf, struct folio *folio),
TP_ARGS(vmf, folio));
DECLARE_HOOK(android_vh_filemap_read,
TP_PROTO(struct file *file, loff_t pos, size_t size),
TP_ARGS(file, pos, size));
+1
View File
@@ -3284,6 +3284,7 @@ static inline void wp_page_reuse(struct vm_fault *vmf, struct folio *folio)
flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte));
entry = pte_mkyoung(vmf->orig_pte);
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
trace_android_vh_wp_page_reuse(vmf, folio);
if (ptep_set_access_flags(vma, vmf->address, vmf->pte, entry, 1))
update_mmu_cache_range(vmf, vma, vmf->address, vmf->pte, 1);
pte_unmap_unlock(vmf->pte, vmf->ptl);