ANDROID: vendor_hooks: add vendor hook in __alloc_pages()

By this vh, so that we can record page information
and add custom optimisations such as cma.

Bug: 305868227
Change-Id: I6d20dc96f864202ea0ca236c82337f385a9054f6
Signed-off-by: Qinglin Li <qinglin.li@amlogic.com>
This commit is contained in:
qinglin.li
2023-10-17 14:31:23 +08:00
committed by Treehugger Robot
parent fb8d8135c3
commit ed5719778f
3 changed files with 6 additions and 0 deletions

View File

@@ -364,3 +364,4 @@ 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);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_xhci_urb_suitable_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_entry);

View File

@@ -164,6 +164,10 @@ 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));
DECLARE_HOOK(android_vh_alloc_pages_entry,
TP_PROTO(gfp_t *gfp, unsigned int order, int preferred_nid,
nodemask_t *nodemask),
TP_ARGS(gfp, order, preferred_nid, nodemask));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View File

@@ -5660,6 +5660,7 @@ struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
gfp_t alloc_gfp; /* The gfp_t that was actually used for allocation */
struct alloc_context ac = { };
trace_android_vh_alloc_pages_entry(&gfp, order, preferred_nid, nodemask);
/*
* There are several places where we assume that the order value is sane
* so bail out early if the request is out of bound.