ANDROID: vendor_hooks: add vendor hook in cma_alloc()

Add android_vh_cma_alloc_busy_info vh after EBUSY not only useful for profiling but also pinned page handling.
Add android_vh_cma_alloc_start/android_vh_cma_alloc_finish to locate alloc_start and alloc_end for optimization.
Because the acr_info has heen removed, the functions need to be updated.

Bug: 234498088
Bug: 295917627
Bug: 416387237
(cherry picked from commit 45cb58e13408b25331797f0f9e6a6d9764af865e)
Change-Id: If1de7b63c431a79889e932ff3363314199175cce
(cherry picked from commit 458a8b878cdba4b84463f9fa35ecccfa7e2a24a4)
Signed-off-by: Edward Wu <edwardwu@realtek.com>
Signed-off-by: frank.song <frank.song@realtek.com>
This commit is contained in:
Edward Wu
2022-06-21 07:43:07 +08:00
committed by Treehugger Robot
parent 21de8f00f4
commit ba364a2340
3 changed files with 20 additions and 1 deletions

View File

@@ -402,6 +402,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_workingset_refault);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_clone_lock);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_unref_folios_to_pcp_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_fail);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_busy_info);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmalloc_node_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vfree_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_scan_control);

View File

@@ -95,6 +95,18 @@ DECLARE_HOOK(android_vh_cma_alloc_bypass,
gfp_t gfp_mask, struct page **page, bool *bypass),
TP_ARGS(cma, count, align, gfp_mask, page, bypass));
DECLARE_HOOK(android_vh_cma_alloc_start,
TP_PROTO(struct cma *cma),
TP_ARGS(cma));
DECLARE_HOOK(android_vh_cma_alloc_finish,
TP_PROTO(struct cma *cma),
TP_ARGS(cma));
DECLARE_HOOK(android_vh_cma_alloc_busy_info,
TP_PROTO(unsigned long *failed_pfn),
TP_ARGS(failed_pfn));
struct compact_control;
DECLARE_HOOK(android_vh_isolate_freepages,
TP_PROTO(struct compact_control *cc, struct page *page, bool *bypass),

View File

@@ -450,6 +450,8 @@ struct page *__cma_alloc(struct cma *cma, unsigned long count,
trace_android_vh_cma_alloc_bypass(cma, count, align, gfp,
&page, &bypass);
trace_android_vh_cma_alloc_start(cma);
if (bypass)
return page;
@@ -536,7 +538,7 @@ struct page *__cma_alloc(struct cma *cma, unsigned long count,
pr_debug("%s(): memory range at pfn 0x%lx %p is busy, retrying\n",
__func__, pfn, pfn_to_page(pfn));
trace_android_vh_cma_alloc_busy_info(&pfn);
trace_cma_alloc_busy_retry(cma->name, pfn, pfn_to_page(pfn),
count, align);
/* try again with a bit different memory target */
@@ -562,6 +564,8 @@ struct page *__cma_alloc(struct cma *cma, unsigned long count,
pr_debug("%s(): returned %p\n", __func__, page);
trace_cma_alloc_finish(name, pfn, page, count, align, ret);
trace_android_vh_cma_alloc_finish(cma);
if (page) {
count_vm_event(CMA_ALLOC_SUCCESS);
cma_sysfs_account_success_pages(cma, count);