ANDROID: mm: create vendor hooks for do_shrink_slab()

The hook function: trace_android_vh_do_shrink_slab is added inside
of the function do_shrink_slab() to changed the numbers of page to
be reclaimed from kernel.

Bug: 279793370
Change-Id: I7c0b955be97f841c69bc99a152b59ed9823707ed
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
(cherry picked from commit aa254e44109ec3f608782cb627ede314f9eef0c6)
This commit is contained in:
Dezhi Huang
2023-05-24 16:28:55 +08:00
committed by Todd Kjos
parent 5567dc9e70
commit 875969d866
3 changed files with 8 additions and 0 deletions
+1
View File
@@ -188,6 +188,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_oem_binder_struct);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_buffer_release);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mglru_should_abort_scan);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_shrink_slab);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio);
+3
View File
@@ -37,6 +37,9 @@ DECLARE_HOOK(android_vh_mglru_should_abort_scan,
DECLARE_HOOK(android_vh_should_memcg_bypass,
TP_PROTO(struct mem_cgroup *memcg, int priority, bool *bypass),
TP_ARGS(memcg, priority, bypass));
DECLARE_HOOK(android_vh_do_shrink_slab,
TP_PROTO(struct shrinker *shrinker, long *freeable),
TP_ARGS(shrinker, freeable));
#endif /* _TRACE_HOOK_VMSCAN_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
+4
View File
@@ -5,6 +5,9 @@
#include <linux/rculist.h>
#include <trace/events/vmscan.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/vmscan.h>
#include "internal.h"
LIST_HEAD(shrinker_list);
@@ -382,6 +385,7 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl,
long scanned = 0, next_deferred;
freeable = shrinker->count_objects(shrinker, shrinkctl);
trace_android_vh_do_shrink_slab(shrinker, &freeable);
if (freeable == 0 || freeable == SHRINK_EMPTY)
return freeable;