ANDROID: mm: cma: add vendor hoook in cma_alloc()

Add vendor hook for cma_alloc latency measuring.

Bug: 177231781
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Ia2dbb26454bd8f03489389b29b9a6c939d3c2bbb
This commit is contained in:
Minchan Kim
2021-04-01 18:25:57 -07:00
parent 180ab1b1e5
commit c6e85ea56b
3 changed files with 16 additions and 0 deletions

View File

@@ -37,6 +37,9 @@
#include <linux/jiffies.h>
#include <trace/events/cma.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/mm.h>
#include "cma.h"
struct cma cma_areas[MAX_CMA_AREAS];
@@ -439,6 +442,9 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
int ret = -ENOMEM;
int num_attempts = 0;
int max_retries = 5;
s64 ts;
trace_android_vh_cma_alloc_start(&ts);
if (!cma || !cma->count || !cma->bitmap)
goto out;
@@ -531,6 +537,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
pr_debug("%s(): returned %p\n", __func__, page);
out:
trace_android_vh_cma_alloc_finish(cma, page, count, align, gfp_mask, ts);
if (page) {
count_vm_event(CMA_ALLOC_SUCCESS);
cma_sysfs_account_success_pages(cma, count);