ANDROID: vendor_hooks: Add hooks for __alloc_pages_direct_reclaim

Provide a vendor hook to allow drain_all_pages to be skipped
during direct reclaim in some cases to avoid delays caused by
it in cases when the benefits of draining pcp lists are known
to be small.

Bug: 220811627
Bug: 234405962
Bug: 395197442
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I0805241f81e0a94afcf62c98e97cff125d4061e2
Signed-off-by: wengle <wengle@oppo.com>
This commit is contained in:
Liujie Xie
2022-02-22 19:29:53 +08:00
committed by Carlos Llamas
parent 8d43b87881
commit 3972d43fc4
3 changed files with 11 additions and 1 deletions
+1
View File
@@ -176,6 +176,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unreserve_highatomic_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue_bulk_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_hw_protection_shutdown);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_slab_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drain_all_pages_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_insert);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_node_delete);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_node_replace);
+5
View File
@@ -305,6 +305,11 @@ DECLARE_HOOK(android_vh_zs_shrinker_adjust,
DECLARE_HOOK(android_vh_zs_shrinker_bypass,
TP_PROTO(bool *bypass),
TP_ARGS(bypass));
DECLARE_HOOK(android_vh_drain_all_pages_bypass,
TP_PROTO(gfp_t gfp_mask, unsigned int order, unsigned long alloc_flags,
int migratetype, unsigned long did_some_progress,
bool *bypass),
TP_ARGS(gfp_mask, order, alloc_flags, migratetype, did_some_progress, bypass));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */
+5 -1
View File
@@ -4242,6 +4242,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,
struct page *page = NULL;
unsigned long pflags;
bool drained = false;
bool skip_pcp_drain = false;
psi_memstall_enter(&pflags);
*did_some_progress = __perform_reclaim(gfp_mask, order, ac);
@@ -4258,7 +4259,10 @@ retry:
*/
if (!page && !drained) {
unreserve_highatomic_pageblock(ac, false);
drain_all_pages(NULL);
trace_android_vh_drain_all_pages_bypass(gfp_mask, order,
alloc_flags, ac->migratetype, *did_some_progress, &skip_pcp_drain);
if (!skip_pcp_drain)
drain_all_pages(NULL);
drained = true;
goto retry;
}