diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index aa00e3550da8..6ee574daf8dd 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -203,6 +203,12 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_set_affinity); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_v3_affinity_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterrupt_tasks); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterrupt_tasks_done); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_meminfo_proc_show); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_mm); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_mem); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_print_slabinfo_header); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cache_show); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watchdog_timer_softlockup); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo); diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 440960110a42..52a7c129ee6d 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -18,6 +18,7 @@ #endif #include #include "internal.h" +#include void __attribute__((weak)) arch_report_meminfo(struct seq_file *m) { @@ -154,6 +155,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) show_val_kb(m, "CmaFree: ", global_zone_page_state(NR_FREE_CMA_PAGES)); #endif + trace_android_vh_meminfo_proc_show(m); hugetlb_report_meminfo(m); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 59867df7b0e9..62c177bf593e 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -45,6 +45,25 @@ 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_meminfo_proc_show, + TP_PROTO(struct seq_file *m), + TP_ARGS(m)); +DECLARE_HOOK(android_vh_exit_mm, + TP_PROTO(struct mm_struct *mm), + TP_ARGS(mm)); +DECLARE_HOOK(android_vh_show_mem, + TP_PROTO(unsigned int filter, nodemask_t *nodemask), + TP_ARGS(filter, nodemask)); +DECLARE_HOOK(android_vh_alloc_pages_slowpath, + TP_PROTO(gfp_t gfp_mask, unsigned int order, unsigned long delta), + TP_ARGS(gfp_mask, order, delta)); +DECLARE_HOOK(android_vh_print_slabinfo_header, + TP_PROTO(struct seq_file *m), + TP_ARGS(m)); +struct slabinfo; +DECLARE_HOOK(android_vh_cache_show, + TP_PROTO(struct seq_file *m, struct slabinfo *sinfo, struct kmem_cache *s), + TP_ARGS(m, sinfo, s)); #endif /* _TRACE_HOOK_MM_H */ diff --git a/kernel/exit.c b/kernel/exit.c index 5d1df016ffc1..1e3b9675fbe5 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -72,6 +72,7 @@ #include #include #include +#include /* * The default value should be high enough to not crash a system that randomly @@ -560,6 +561,7 @@ static void exit_mm(void) task_unlock(current); mmap_read_unlock(mm); mm_update_next_owner(mm); + trace_android_vh_exit_mm(mm); mmput(mm); if (test_thread_flag(TIF_MEMDIE)) exit_oom_victim(); diff --git a/lib/show_mem.c b/lib/show_mem.c index 0d7585cde2a6..f62c5b38470c 100644 --- a/lib/show_mem.c +++ b/lib/show_mem.c @@ -7,6 +7,7 @@ #include #include +#include void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx) { @@ -41,4 +42,5 @@ void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx) #ifdef CONFIG_MEMORY_FAILURE printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages)); #endif + trace_android_vh_show_mem(filter, nodemask); } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7675d1c2d813..78f674f6e3ee 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -76,6 +76,8 @@ #include #include #include +#include + #include #include #include @@ -5116,7 +5118,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, unsigned int cpuset_mems_cookie; unsigned int zonelist_iter_cookie; int reserve_flags; - + unsigned long alloc_start = jiffies; /* * We also sanity check to catch abuse of atomic reserves being used by * callers that are not in atomic context. @@ -5381,6 +5383,7 @@ fail: warn_alloc(gfp_mask, ac->nodemask, "page allocation failure: order:%u", order); got_pg: + trace_android_vh_alloc_pages_slowpath(gfp_mask, order, alloc_start); return page; } diff --git a/mm/slab_common.c b/mm/slab_common.c index 0042fb2730d1..01da1194d5f6 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -31,6 +31,8 @@ #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include enum slab_state slab_state; LIST_HEAD(slab_caches); @@ -1200,6 +1202,7 @@ static void print_slabinfo_header(struct seq_file *m) seq_puts(m, " : globalstat "); seq_puts(m, " : cpustat "); #endif + trace_android_vh_print_slabinfo_header(m); seq_putc(m, '\n'); } @@ -1235,6 +1238,7 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m) seq_printf(m, " : slabdata %6lu %6lu %6lu", sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail); slabinfo_show_stats(m, s); + trace_android_vh_cache_show(m, &sinfo, s); seq_putc(m, '\n'); }