From 6f0b82dd8a13dce41128eb9818e792ed940b57f2 Mon Sep 17 00:00:00 2001 From: Dmitry Skiba Date: Sat, 11 Jan 2025 01:55:03 +0000 Subject: [PATCH] ANDROID: mm: add kswapd wake/done rvh These restricted hooks are needed for cases when vendor implementation needs to call sleeping functions. See the bug for details. Bug: 379922825 Change-Id: I0e5626bed930830caf7f96a5b051b3174f4cf250 Signed-off-by: Dmitry Skiba --- drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/vmscan.h | 7 +++++++ mm/vmscan.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 8fe40d59ce14..6da9ef6372b2 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -383,6 +383,8 @@ 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_rvh_vmscan_kswapd_wake); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmscan_kswapd_done); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vmscan_kswapd_done); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_begin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_end); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index 781c1a4a2072..fba2efaa294a 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -53,6 +53,13 @@ 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)); +DECLARE_RESTRICTED_HOOK(android_rvh_vmscan_kswapd_wake, + TP_PROTO(int node_id, unsigned int highest_zoneidx, unsigned int alloc_order), + TP_ARGS(node_id, highest_zoneidx, alloc_order), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_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), 1); DECLARE_HOOK(android_vh_handle_trylock_failed_folio, TP_PROTO(struct list_head *folio_list), TP_ARGS(folio_list)); diff --git a/mm/vmscan.c b/mm/vmscan.c index 5e92c1061fe9..77af42f8d801 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7874,8 +7874,12 @@ kswapd_try_sleep: */ trace_mm_vmscan_kswapd_wake(pgdat->node_id, highest_zoneidx, alloc_order); + trace_android_rvh_vmscan_kswapd_wake(pgdat->node_id, highest_zoneidx, + alloc_order); reclaim_order = balance_pgdat(pgdat, alloc_order, highest_zoneidx); + trace_android_rvh_vmscan_kswapd_done(pgdat->node_id, highest_zoneidx, + alloc_order, reclaim_order); trace_android_vh_vmscan_kswapd_done(pgdat->node_id, highest_zoneidx, alloc_order, reclaim_order); if (reclaim_order < alloc_order)