ANDROID: mm: vh for compaction begin/end
Add vendor hook for compaction begin/end. The first use would be
to measure compaction durations.
Bug: 229927848
Test: local kernel build test
Signed-off-by: Robin Hsu <robinhsu@google.com>
Change-Id: I3d95434bf49b37199056dc9ddfc36a59a7de17b7
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 13b6bd38bb1f43bfffdb08c8f3a4a20d36ccd670)
diff --git a/mm/compaction.c b/mm/compaction.c
index dca1982..4ca8795 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -44,6 +44,8 @@ static inline void count_compact_events(enum vm_event_item item, long delta)
#define CREATE_TRACE_POINTS
#include <trace/events/compaction.h>
+#undef CREATE_TRACE_POINTS
+#include <trace/hooks/mm.h>
#define block_start_pfn(pfn, order) round_down(pfn, 1UL << (order))
#define block_end_pfn(pfn, order) ALIGN((pfn) + 1, 1UL << (order))
@@ -2338,6 +2340,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
unsigned long last_migrated_pfn;
const bool sync = cc->mode != MIGRATE_ASYNC;
bool update_cached;
+ long vendor_ret;
/*
* These counters track activities during zone compaction. Initialize
@@ -2409,6 +2412,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
trace_mm_compaction_begin(start_pfn, cc->migrate_pfn,
cc->free_pfn, end_pfn, sync);
+ trace_android_vh_mm_compaction_begin(cc, &vendor_ret);
/* lru_add_drain_all could be expensive with involving other CPUs */
lru_add_drain();
@@ -2535,6 +2539,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
count_compact_events(COMPACTMIGRATE_SCANNED, cc->total_migrate_scanned);
count_compact_events(COMPACTFREE_SCANNED, cc->total_free_scanned);
+ trace_android_vh_mm_compaction_end(cc, vendor_ret);
trace_mm_compaction_end(start_pfn, cc->migrate_pfn,
cc->free_pfn, end_pfn, sync, ret);