From 21c64f5a218b059aa53c4d6c35a50889e95bd4dd 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 Bug: 330661608 Bug: 395197442 Change-Id: Id6e0a97003f0a156cff4d0996bc38bcd89b1dc69 Signed-off-by: John Hsu Signed-off-by: wengle --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/vmscan.h | 5 +++++ mm/vmscan.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 6698449904f5..87c81555a5e8 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -407,3 +407,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_wb_dirty_limits); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vfs_fsync_range); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_fcntl); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_evict); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vmscan_kswapd_done); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index 75c810687f9f..b16e2dd323fa 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -59,6 +59,11 @@ DECLARE_HOOK(android_vh_tune_scan_type, 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)); +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 4802b9c9d89e..73b03c34cf77 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7347,6 +7347,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; }