diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 49a57f2dbe41..d87dbd27a382 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -402,6 +402,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_workingset_refault); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_clone_lock); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_unref_folios_to_pcp_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_fail); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_start); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_finish); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_busy_info); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmalloc_node_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vfree_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_scan_control); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 0d6509c37b2a..82aba2511e09 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -95,6 +95,18 @@ DECLARE_HOOK(android_vh_cma_alloc_bypass, gfp_t gfp_mask, struct page **page, bool *bypass), TP_ARGS(cma, count, align, gfp_mask, page, bypass)); +DECLARE_HOOK(android_vh_cma_alloc_start, + TP_PROTO(struct cma *cma), + TP_ARGS(cma)); + +DECLARE_HOOK(android_vh_cma_alloc_finish, + TP_PROTO(struct cma *cma), + TP_ARGS(cma)); + +DECLARE_HOOK(android_vh_cma_alloc_busy_info, + TP_PROTO(unsigned long *failed_pfn), + TP_ARGS(failed_pfn)); + struct compact_control; DECLARE_HOOK(android_vh_isolate_freepages, TP_PROTO(struct compact_control *cc, struct page *page, bool *bypass), diff --git a/mm/cma.c b/mm/cma.c index 911eed21cb0f..42297d6b5f7a 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -450,6 +450,8 @@ struct page *__cma_alloc(struct cma *cma, unsigned long count, trace_android_vh_cma_alloc_bypass(cma, count, align, gfp, &page, &bypass); + trace_android_vh_cma_alloc_start(cma); + if (bypass) return page; @@ -536,7 +538,7 @@ struct page *__cma_alloc(struct cma *cma, unsigned long count, pr_debug("%s(): memory range at pfn 0x%lx %p is busy, retrying\n", __func__, pfn, pfn_to_page(pfn)); - + trace_android_vh_cma_alloc_busy_info(&pfn); trace_cma_alloc_busy_retry(cma->name, pfn, pfn_to_page(pfn), count, align); /* try again with a bit different memory target */ @@ -562,6 +564,8 @@ struct page *__cma_alloc(struct cma *cma, unsigned long count, pr_debug("%s(): returned %p\n", __func__, page); trace_cma_alloc_finish(name, pfn, page, count, align, ret); + trace_android_vh_cma_alloc_finish(cma); + if (page) { count_vm_event(CMA_ALLOC_SUCCESS); cma_sysfs_account_success_pages(cma, count);