ANDROID: mm: add vh for kcompactd_cpu_online()

kcompactd_cpu_online() changes kcompactd cpumask, potentially
overwriting any vendor-specific cpumask that was there. This
hook allows vendors to re-set the cpumask.

Bug: 367400751
Bug: 369220046
Change-Id: I45b92bcd16fbf2d5d76474287db659e32af64201
Signed-off-by: Dmitry Skiba <[email protected]>
(cherry picked from commit b3a2458fc6e6bf265ee52297f6478e4b43725fb2)
diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c
index ef78e46..0237d81 100644
--- a/drivers/android/vendor_hooks.c
+++ b/drivers/android/vendor_hooks.c
@@ -377,6 +377,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_may_oom_exit);
 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);
+EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_kcompactd_cpu_online);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_bus_iommu_probe);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h
index 194f553..a1cb215 100644
--- a/include/trace/hooks/mm.h
+++ b/include/trace/hooks/mm.h
@@ -145,6 +145,9 @@ DECLARE_HOOK(android_vh_mm_compaction_begin,
 DECLARE_HOOK(android_vh_mm_compaction_end,
 	TP_PROTO(struct compact_control *cc, long vendor_ret),
 	TP_ARGS(cc, vendor_ret));
+DECLARE_HOOK(android_vh_mm_kcompactd_cpu_online,
+	TP_PROTO(int cpu),
+	TP_ARGS(cpu));
 DECLARE_HOOK(android_vh_free_unref_page_bypass,
 	TP_PROTO(struct page *page, int order, int migratetype, bool *bypass),
 	TP_ARGS(page, order, migratetype, bypass));
diff --git a/mm/compaction.c b/mm/compaction.c
index 6dbb02d..1ff0baf 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -3070,6 +3070,7 @@ static int kcompactd_cpu_online(unsigned int cpu)
 			if (pgdat->kcompactd)
 				set_cpus_allowed_ptr(pgdat->kcompactd, mask);
 	}
+	trace_android_vh_mm_kcompactd_cpu_online(cpu);
 	return 0;
 }