ANDROID: mm: create vendor hooks for shrink_slab()

Trace_android_vh_shrink_slab_bypass is added in the beginning of
the function shrink_slab() to bypass kernel page reclaim in some
conditons.

Bug: 279793370
Change-Id: I6d5c8be28addf43d6fc9d07b5133135641590c3a
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
This commit is contained in:
Dezhi Huang
2023-05-24 16:16:57 +08:00
committed by Suren Baghdasaryan
parent 751bcb9de0
commit da4e60efe1
3 changed files with 9 additions and 0 deletions

View File

@@ -243,6 +243,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_reply);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_slab_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_page_wmark);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_add_new_anon_rmap);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);

View File

@@ -15,6 +15,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_balance_anon_file_reclaim,
DECLARE_HOOK(android_vh_kswapd_per_node,
TP_PROTO(int nid, bool *skip, bool run),
TP_ARGS(nid, skip, run));
DECLARE_HOOK(android_vh_shrink_slab_bypass,
TP_PROTO(gfp_t gfp_mask, int nid, struct mem_cgroup *memcg, int priority, bool *bypass),
TP_ARGS(gfp_mask, nid, memcg, priority, bypass));
#endif /* _TRACE_HOOK_VMSCAN_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -991,6 +991,11 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid,
{
unsigned long ret, freed = 0;
struct shrinker *shrinker;
bool bypass = false;
trace_android_vh_shrink_slab_bypass(gfp_mask, nid, memcg, priority, &bypass);
if (bypass)
return 0;
/*
* The root memcg might be allocated even though memcg is disabled