diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index fcd653650197..8551fb9adc69 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -224,6 +224,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_buffer_release); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mglru_should_abort_scan); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_shrink_slab); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_page_wmark); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_add_new_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 81b5daac494c..8cb47aa66b0a 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -199,6 +199,13 @@ DECLARE_HOOK(android_vh_show_smap, unsigned long swap_shared, unsigned long writeback, unsigned long same, unsigned long huge), TP_ARGS(m, swap_shared, writeback, same, huge)); +DECLARE_HOOK(android_vh_get_page_wmark, + TP_PROTO(unsigned int alloc_flags, unsigned long *page_wmark), + TP_ARGS(alloc_flags, page_wmark)); +DECLARE_HOOK(android_vh_page_add_new_anon_rmap, + TP_PROTO(struct page *page, struct vm_area_struct *vma, + unsigned long address), + TP_ARGS(page, vma, address)); DECLARE_HOOK(android_vh_alloc_pages_slowpath_start, TP_PROTO(u64 *stime), TP_ARGS(stime)); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f84618ee5d05..26eb7f20f798 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -66,6 +66,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(mm_page_alloc); EXPORT_TRACEPOINT_SYMBOL_GPL(mm_page_free); +#undef CREATE_TRACE_POINTS +#include + /* Free Page Internal flags: for internal, non-pcp variants of free_pages(). */ typedef int __bitwise fpi_t; @@ -3682,6 +3685,7 @@ retry: check_alloc_wmark: mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK); + trace_android_vh_get_page_wmark(alloc_flags, &mark); if (!zone_watermark_fast(zone, order, mark, ac->highest_zoneidx, alloc_flags, gfp_mask)) { diff --git a/mm/rmap.c b/mm/rmap.c index b9ea64794345..73f8d34455c8 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1470,6 +1470,7 @@ void folio_add_new_anon_rmap(struct folio *folio, struct vm_area_struct *vma, __folio_mod_stat(folio, nr, nr_pmdmapped); mod_mthp_stat(folio_order(folio), MTHP_STAT_NR_ANON, 1); + trace_android_vh_page_add_new_anon_rmap(&folio->page, vma, address); } static __always_inline void __folio_add_file_rmap(struct folio *folio,