ANDROID: vendor_hooks:vendor hook for __alloc_pages_slowpath.

add vendor hook in __alloc_pages_slowpath ahead of
__alloc_pages_direct_reclaim and warn_alloc.

Bug: 243629905
Change-Id: Ieacc6cf79823c0bfacfdeec9afb55ed66f40d0b0
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
(cherry picked from commit 0312e9cd22b100a088ff64ab36b2db2eb9f28b7c)
This commit is contained in:
xiaofeng
2022-08-24 19:34:06 +08:00
committed by Suren Baghdasaryan
parent bc08447eb7
commit dec2f52d08
3 changed files with 21 additions and 0 deletions

View File

@@ -453,3 +453,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_pages);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_shmem_page_flag);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_pelt_multiplier);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_reclaim_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_failure_bypass);

View File

@@ -260,6 +260,14 @@ DECLARE_HOOK(android_vh_set_shmem_page_flag,
DECLARE_HOOK(android_vh_remove_vmalloc_stack,
TP_PROTO(struct vm_struct *vm),
TP_ARGS(vm));
DECLARE_HOOK(android_vh_alloc_pages_reclaim_bypass,
TP_PROTO(gfp_t gfp_mask, int order, int alloc_flags,
int migratetype, struct page **page),
TP_ARGS(gfp_mask, order, alloc_flags, migratetype, page));
DECLARE_HOOK(android_vh_alloc_pages_failure_bypass,
TP_PROTO(gfp_t gfp_mask, int order, int alloc_flags,
int migratetype, struct page **page),
TP_ARGS(gfp_mask, order, alloc_flags, migratetype, page));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_MM_H */

View File

@@ -4924,6 +4924,12 @@ retry:
if (current->flags & PF_MEMALLOC)
goto nopage;
trace_android_vh_alloc_pages_reclaim_bypass(gfp_mask, order,
alloc_flags, ac->migratetype, &page);
if (page)
goto got_pg;
/* Try direct reclaim and then allocating */
page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac,
&did_some_progress);
@@ -5031,6 +5037,11 @@ nopage:
goto retry;
}
fail:
trace_android_vh_alloc_pages_failure_bypass(gfp_mask, order,
alloc_flags, ac->migratetype, &page);
if (page)
goto got_pg;
warn_alloc(gfp_mask, ac->nodemask,
"page allocation failure: order:%u", order);
got_pg: