ANDROID: vendor_hooks: add vendor hook in cma_alloc()

By this vh, so that we can reimplement the function cma_alloc()

Bug: 299425220
Change-Id: I7068915c3c38784dba25d130434abe595b06b996
Signed-off-by: Wanwei Jiang <wanwei.jiang@amlogic.com>
This commit is contained in:
Wanwei Jiang
2023-09-07 17:39:59 +08:00
committed by Todd Kjos
parent 5fae54013c
commit 20fb3d0214
3 changed files with 11 additions and 0 deletions

View File

@@ -357,3 +357,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_uid);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_user);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_bypass);

View File

@@ -142,6 +142,10 @@ DECLARE_HOOK(android_vh_mem_cgroup_css_offline,
DECLARE_HOOK(android_vh_si_meminfo,
TP_PROTO(struct sysinfo *val),
TP_ARGS(val));
DECLARE_HOOK(android_vh_cma_alloc_bypass,
TP_PROTO(struct cma *cma, unsigned long count, unsigned int align,
gfp_t gfp_mask, struct page **page, bool *bypass),
TP_ARGS(cma, count, align, gfp_mask, page, bypass));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View File

@@ -446,6 +446,12 @@ struct page *cma_alloc(struct cma *cma, unsigned long count,
int max_retries = 5;
s64 ts;
struct cma_alloc_info cma_info = {0};
bool bypass = false;
trace_android_vh_cma_alloc_bypass(cma, count, align, gfp_mask,
&page, &bypass);
if (bypass)
return page;
trace_android_vh_cma_alloc_start(&ts);