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:
@@ -102,3 +102,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_show_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_format_check);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_free);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_bypass);
|
||||
|
||||
@@ -19,7 +19,6 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_gfp_zone_flags,
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_set_readahead_gfp_mask,
|
||||
TP_PROTO(gfp_t *flags),
|
||||
TP_ARGS(flags), 1);
|
||||
|
||||
*/
|
||||
struct mem_cgroup;
|
||||
DECLARE_HOOK(android_vh_mem_cgroup_alloc,
|
||||
@@ -29,6 +28,10 @@ DECLARE_HOOK(android_vh_mem_cgroup_free,
|
||||
TP_PROTO(struct mem_cgroup *memcg),
|
||||
TP_ARGS(memcg));
|
||||
|
||||
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 */
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <trace/events/cma.h>
|
||||
#undef CREATE_TRACE_POINTS
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "cma.h"
|
||||
@@ -420,11 +422,17 @@ struct page *__cma_alloc(struct cma *cma, unsigned long count,
|
||||
const char *name = cma ? cma->name : NULL;
|
||||
int num_attempts = 0;
|
||||
int max_retries = 5;
|
||||
bool bypass = false;
|
||||
|
||||
if (WARN_ON_ONCE((gfp & GFP_KERNEL) == 0 ||
|
||||
(gfp & ~(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY)) != 0))
|
||||
return page;
|
||||
|
||||
trace_android_vh_cma_alloc_bypass(cma, count, align, gfp,
|
||||
&page, &bypass);
|
||||
if (bypass)
|
||||
return page;
|
||||
|
||||
trace_cma_alloc_start(name, count, align);
|
||||
|
||||
if (!cma || !cma->count || !cma->bitmap)
|
||||
|
||||
Reference in New Issue
Block a user