ANDROID: vendor_hook: customize gfp and orders to alloc large folio

This hook is used to dynamic modify:
1.gfp_mask, which control behavior for allocation.
2.orders, which control highest order to try alloc folio.
3.order, which need assign `order = highest_order(orders);`

Bug: 438090847
Change-Id: Id2e89a2c674acb7bea6867cdb9f84163c266d7db
Signed-off-by: chunpeng li <lichunpeng@xiaomi.com>
Signed-off-by: yan chang <changyan1@xiaomi.com>
This commit is contained in:
chunpeng li
2024-08-22 15:47:58 +08:00
committed by Treehugger Robot
parent de2973e844
commit bb9c59d1f1
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -581,6 +581,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pr_set_vma_name_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_charge);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_add_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_customize_thp_gfp_orders);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_uid);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_user);
+3
View File
@@ -600,6 +600,9 @@ DECLARE_HOOK(android_vh_mm_split_huge_page_bypass,
DECLARE_HOOK(android_vh_mm_try_split_folio_bypass,
TP_PROTO(struct folio *folio, bool *bypass),
TP_ARGS(folio, bypass));
DECLARE_HOOK(android_vh_customize_thp_gfp_orders,
TP_PROTO(gfp_t *gfp_mask, unsigned long *orders, int *order),
TP_ARGS(gfp_mask, orders, order));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */
+1
View File
@@ -4745,6 +4745,7 @@ static struct folio *alloc_anon_folio(struct vm_fault *vmf)
if (folio)
goto allocated;
trace_android_vh_customize_thp_gfp_orders(&gfp, &orders, &order);
while (orders) {
addr = ALIGN_DOWN(vmf->address, PAGE_SIZE << order);
folio = vma_alloc_folio(gfp, order, vma, addr, true);