From e140f1a43f5714fb6e3f6bd4eaf5263e65ada60c Mon Sep 17 00:00:00 2001 From: Jiewen Wang Date: Wed, 2 Aug 2023 19:40:04 +0800 Subject: [PATCH] ANDROID: vendor_hooks: Add tune scan type hook in get_scan_count() Add hook in get_scan_count() for oem to wield customized reclamation strategy Bug: 294180281 Bug: 336401947 Change-Id: Ic54d35128e458661fc2b641809f5371b1d9a488e Signed-off-by: Jiewen Wang Signed-off-by: huzhanyuan --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/vmscan.h | 4 ++++ mm/vmscan.c | 1 + 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ec3f2ccc37fa..645c2ec8626f 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -229,6 +229,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue_smallest_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_one_page_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_migration_target_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_adjust_alloc_flags); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wait_for_work); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_oem_binder_struct); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_received); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index 54161cf847b2..5083d9c2e72f 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -52,6 +52,10 @@ DECLARE_HOOK(android_vh_tune_scan_control, DECLARE_HOOK(android_vh_page_referenced_check_bypass, TP_PROTO(struct folio *folio, unsigned long nr_to_scan, int lru, bool *bypass), TP_ARGS(folio, nr_to_scan, lru, bypass)); +enum scan_balance; +DECLARE_HOOK(android_vh_tune_scan_type, + TP_PROTO(enum scan_balance *scan_type), + TP_ARGS(scan_type)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/vmscan.c b/mm/vmscan.c index afefefc7c9de..11e55b4268c2 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2508,6 +2508,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, fraction[1] = fp; denominator = ap + fp; out: + trace_android_vh_tune_scan_type(&scan_balance); for_each_evictable_lru(lru) { bool file = is_file_lru(lru); unsigned long lruvec_size;