diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index d4352dfeb34d..7ac6fd6d69c8 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -431,6 +431,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_read_done); 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_rvh_handle_pte_fault_end); 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); @@ -441,9 +442,13 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swap_slot_cache_active); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_drain_slots_cache_cpu); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drain_slots_cache_cpu); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_swap_slot_cache); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_swap_slot_cache); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_free_swap_slot); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_swap_slot); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_get_swap_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_swap_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_cold_or_pageout); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); @@ -453,6 +458,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_swap_info_struct); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_swapinfo); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_si); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_pages); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_shmem_page_flag); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 358a89380982..3f32c876441f 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -193,6 +193,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_RESTRICTED_HOOK(android_rvh_handle_pte_fault_end, + TP_PROTO(struct vm_fault *vmf, unsigned long highest_memmap_pfn), + TP_ARGS(vmf, highest_memmap_pfn), 1); 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)); @@ -223,16 +226,30 @@ DECLARE_HOOK(android_vh_count_swpout_vm_event, DECLARE_HOOK(android_vh_swap_slot_cache_active, TP_PROTO(bool swap_slot_cache_active), TP_ARGS(swap_slot_cache_active)); +DECLARE_RESTRICTED_HOOK(android_rvh_drain_slots_cache_cpu, + TP_PROTO(struct swap_slots_cache *cache, unsigned int type, + bool free_slots, bool *skip), + TP_ARGS(cache, type, free_slots, skip), 1); DECLARE_HOOK(android_vh_drain_slots_cache_cpu, TP_PROTO(struct swap_slots_cache *cache, unsigned int type, bool free_slots, bool *skip), TP_ARGS(cache, type, free_slots, skip)); +DECLARE_RESTRICTED_HOOK(android_rvh_alloc_swap_slot_cache, + TP_PROTO(struct swap_slots_cache *cache, int *ret, bool *skip), + TP_ARGS(cache, ret, skip), 1); DECLARE_HOOK(android_vh_alloc_swap_slot_cache, TP_PROTO(struct swap_slots_cache *cache, int *ret, bool *skip), TP_ARGS(cache, ret, skip)); +DECLARE_RESTRICTED_HOOK(android_rvh_free_swap_slot, + TP_PROTO(swp_entry_t entry, struct swap_slots_cache *cache, bool *skip), + TP_ARGS(entry, cache, skip), 1); DECLARE_HOOK(android_vh_free_swap_slot, TP_PROTO(swp_entry_t entry, struct swap_slots_cache *cache, bool *skip), TP_ARGS(entry, cache, skip)); +DECLARE_RESTRICTED_HOOK(android_rvh_get_swap_page, + TP_PROTO(struct page *page, swp_entry_t *entry, + struct swap_slots_cache *cache, bool *found), + TP_ARGS(page, entry, cache, found), 1); DECLARE_HOOK(android_vh_get_swap_page, TP_PROTO(struct page *page, swp_entry_t *entry, struct swap_slots_cache *cache, bool *found), @@ -255,6 +272,9 @@ DECLARE_HOOK(android_vh_init_swap_info_struct, DECLARE_HOOK(android_vh_si_swapinfo, TP_PROTO(struct swap_info_struct *si, bool *skip), TP_ARGS(si, skip)); +DECLARE_RESTRICTED_HOOK(android_rvh_alloc_si, + TP_PROTO(struct swap_info_struct **p, bool *skip), + TP_ARGS(p, skip), 1); DECLARE_HOOK(android_vh_alloc_si, TP_PROTO(struct swap_info_struct **p, bool *skip), TP_ARGS(p, skip)); diff --git a/mm/memory.c b/mm/memory.c index 85554eca3da9..70384a99bfcf 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4777,6 +4777,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_rvh_handle_pte_fault_end(vmf, highest_memmap_pfn); trace_android_vh_handle_pte_fault_end(vmf, highest_memmap_pfn); unlock: pte_unmap_unlock(vmf->pte, vmf->ptl); diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 1392649a4d9a..43231ae6c3fd 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -133,6 +133,8 @@ static int alloc_swap_slot_cache(unsigned int cpu) * as kvzalloc could trigger reclaim and get_swap_page, * which can lock swap_slots_cache_mutex. */ + trace_android_rvh_alloc_swap_slot_cache(&per_cpu(swp_slots, cpu), + &ret, &skip); trace_android_vh_alloc_swap_slot_cache(&per_cpu(swp_slots, cpu), &ret, &skip); if (skip) @@ -190,6 +192,8 @@ static void drain_slots_cache_cpu(unsigned int cpu, unsigned int type, bool skip = false; cache = &per_cpu(swp_slots, cpu); + trace_android_rvh_drain_slots_cache_cpu(cache, type, + free_slots, &skip); trace_android_vh_drain_slots_cache_cpu(cache, type, free_slots, &skip); if (skip) @@ -298,6 +302,7 @@ int free_swap_slot(swp_entry_t entry) bool skip = false; cache = raw_cpu_ptr(&swp_slots); + trace_android_rvh_free_swap_slot(entry, cache, &skip); trace_android_vh_free_swap_slot(entry, cache, &skip); if (skip) return 0; @@ -335,6 +340,7 @@ swp_entry_t get_swap_page(struct page *page) bool found = false; entry.val = 0; + trace_android_rvh_get_swap_page(page, &entry, raw_cpu_ptr(&swp_slots), &found); trace_android_vh_get_swap_page(page, &entry, raw_cpu_ptr(&swp_slots), &found); if (found) goto out; diff --git a/mm/swapfile.c b/mm/swapfile.c index 677f235806c2..b3cc17423d38 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2908,6 +2908,7 @@ static struct swap_info_struct *alloc_swap_info(void) int i; bool skip = false; + trace_android_rvh_alloc_si(&p, &skip); trace_android_vh_alloc_si(&p, &skip); if (!skip) p = kvzalloc(struct_size(p, avail_lists, nr_node_ids), GFP_KERNEL);