diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index c6e334d3d0ed..f2d7f69c6791 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -287,3 +287,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_failure_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_pageout_swap_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_swapin_walk_pmd_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_process_madvise_end); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap); diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index a954305fbc31..be76c1ccff1b 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -403,6 +404,9 @@ struct mem_size_stats { unsigned long shmem_thp; unsigned long file_thp; unsigned long swap; + unsigned long writeback; + unsigned long same; + unsigned long huge; unsigned long shared_hugetlb; unsigned long private_hugetlb; u64 pss; @@ -552,6 +556,9 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, } else { mss->swap_pss += (u64)PAGE_SIZE << PSS_SHIFT; } + trace_android_vh_smaps_pte_entry(swpent, + &mss->writeback, + &mss->same, &mss->huge); } else if (is_pfn_swap_entry(swpent)) { if (is_migration_entry(swpent)) migration = true; @@ -844,6 +851,7 @@ static void __show_smap(struct seq_file *m, const struct mem_size_stats *mss, SEQ_PUT_DEC(" kB\nLocked: ", mss->pss_locked >> PSS_SHIFT); seq_puts(m, " kB\n"); + trace_android_vh_show_smap(m, mss->writeback, mss->same, mss->huge); } static int show_smap(struct seq_file *m, void *v) diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 3695f42143ca..46cb83244de3 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -81,6 +81,14 @@ DECLARE_HOOK(android_vh_madvise_swapin_walk_pmd_entry, DECLARE_HOOK(android_vh_process_madvise_end, TP_PROTO(int behavior, ssize_t *ret), TP_ARGS(behavior, ret)); +DECLARE_HOOK(android_vh_smaps_pte_entry, + TP_PROTO(swp_entry_t entry, unsigned long *writeback, + unsigned long *same, unsigned long *huge), + TP_ARGS(entry, writeback, same, huge)); +DECLARE_HOOK(android_vh_show_smap, + TP_PROTO(struct seq_file *m, unsigned long writeback, + unsigned long same, unsigned long huge), + TP_ARGS(m, writeback, same, huge)); #endif /* _TRACE_HOOK_MM_H */