ANDROID: mm: mglru: add vendor_hook for should_abort_scan()

Add android_vh_mglru_should_abort_scan_ex() the hook is
similar to android_vh_mglru_should_abort_scan() introduced in
https://android-review.googlesource.com/c/kernel/common/+/3452054
but accepts a vendor data field to store the statistics of reclaim.

Bug: 365008739
Bug: 449066551
Bug: 451083029
Change-Id: I1c64dfebf5f9fc3766279c84b9b26fbb89a0997a
Signed-off-by: hailong <hailong.liu@oppo.com>
(cherry picked from commit c06b1f4b2109ea3fb82fe6fad37c7de01660faf1)
This commit is contained in:
hailong
2025-10-03 17:21:18 +08:00
committed by Hailong Liu
parent 9e8a1bb6fb
commit f9d06fbaa8
3 changed files with 8 additions and 0 deletions
+1
View File
@@ -287,6 +287,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_mglru_should_abort_scan_ex);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_shrink_slab);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_page_wmark);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_add_new_anon_rmap);
+3
View File
@@ -60,6 +60,9 @@ DECLARE_HOOK(android_vh_mglru_should_abort_scan,
TP_PROTO(unsigned long nr_reclaimed, unsigned long nr_to_reclaim,
unsigned int order, bool *bypass),
TP_ARGS(nr_to_reclaim, nr_reclaimed, order, bypass));
DECLARE_HOOK(android_vh_mglru_should_abort_scan_ex,
TP_PROTO(u64 *ext, bool *bypass),
TP_ARGS(ext, bypass));
DECLARE_HOOK(android_vh_mglru_aging_bypass,
TP_PROTO(struct lruvec *lruvec, unsigned long max_seq,
int swappiness, bool *bypass, bool *young),
+4
View File
@@ -4912,6 +4912,10 @@ static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc)
trace_android_vh_mglru_should_abort_scan(sc->nr_reclaimed,
sc->nr_to_reclaim, sc->order, &bypass);
#ifdef CONFIG_ANDROID_VENDOR_OEM_DATA
trace_android_vh_mglru_should_abort_scan_ex(&sc->android_vendor_data1,
&bypass);
#endif
/* don't abort memcg reclaim to ensure fairness */
if (!root_reclaim(sc) && !bypass)
return false;