From 30d86f760c183e3acd3641e97d7ee8463477698b Mon Sep 17 00:00:00 2001 From: JohnHsu Date: Mon, 25 Sep 2023 17:28:48 +0800 Subject: [PATCH] ANDROID: mm: Add vendor hooks for recording when kswapd finishing the reclaim job To monitor the reclaiming ability of kswapd, add vendor hook recording when the kswapd finish the reclaiming job and the reclaim progress. android_vh_vmscan_kswpad_done(int, unsigned int, unsigned int, unsigned int) Bug: 301044280 Change-Id: Id6e0a97003f0a156cff4d0996bc38bcd89b1dc69 Signed-off-by: John Hsu --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/vmscan.h | 4 ++++ mm/vmscan.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 5dcdb52ee06f..a705333dc1b3 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -340,3 +340,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_try_to_compact_pages_exit); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_direct_reclaim_enter); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_direct_reclaim_exit); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_may_oom_exit); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vmscan_kswapd_done); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index 625d30d75757..f9effdd2d03e 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -49,6 +49,10 @@ DECLARE_HOOK(android_vh_tune_swappiness, DECLARE_HOOK(android_vh_scan_abort_check_wmarks, TP_PROTO(bool *check_wmarks), TP_ARGS(check_wmarks)); +DECLARE_HOOK(android_vh_vmscan_kswapd_done, + TP_PROTO(int node_id, unsigned int highest_zoneidx, unsigned int alloc_order, + unsigned int reclaim_order), + TP_ARGS(node_id, highest_zoneidx, alloc_order, reclaim_order)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/vmscan.c b/mm/vmscan.c index d1b9313ef88f..de0a079c029f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7788,6 +7788,8 @@ kswapd_try_sleep: alloc_order); reclaim_order = balance_pgdat(pgdat, alloc_order, highest_zoneidx); + trace_android_vh_vmscan_kswapd_done(pgdat->node_id, highest_zoneidx, + alloc_order, reclaim_order); if (reclaim_order < alloc_order) goto kswapd_try_sleep; }