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: 387438223
Bug: 305868227
Change-Id: I6d20dc96f864202ea0ca236c82337f385a9054f6
Signed-off-by: qinglin.li <qinglin.li@amlogic.com>
This commit is contained in:
qinglin.li
2025-01-03 18:48:22 +08:00
committed by Treehugger Robot
parent bae0ccccfb
commit 5c06e6f0f8
3 changed files with 7 additions and 0 deletions
+1
View File
@@ -210,3 +210,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_wq_wait_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_work_wait_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_work_wait_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_entry);
+5
View File
@@ -78,6 +78,11 @@ DECLARE_HOOK(android_vh_kmalloc_large_alloced,
DECLARE_RESTRICTED_HOOK(android_rvh_ctl_dirty_rate,
TP_PROTO(struct inode *inode),
TP_ARGS(inode), 1);
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 */
+1
View File
@@ -4735,6 +4735,7 @@ struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order,
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.