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 <[email protected]>
diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c
index 8fe40d5..6da9ef6 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 781c1a4..fba2efa 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 5e92c10..77af42f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7874,8 +7874,12 @@ int kswapd(void *p)
*/
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)