diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 0e922f2a8ab1..3a00cc61e30a 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -67,7 +67,7 @@ #include #include #include - +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event * associated with them) to allow external modules to probe them. @@ -335,3 +335,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_received); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_oem_binder_struct); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_buf); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_exit); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_try_to_compact_pages_exit); diff --git a/include/trace/hooks/compaction.h b/include/trace/hooks/compaction.h new file mode 100644 index 000000000000..3286de01d58b --- /dev/null +++ b/include/trace/hooks/compaction.h @@ -0,0 +1,20 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM compaction + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_COMPACTION_H + +#include + +DECLARE_HOOK(android_vh_compaction_exit, + TP_PROTO(int node_id, int order, const int highest_zoneidx), + TP_ARGS(node_id, order, highest_zoneidx)); +enum compact_result; +DECLARE_HOOK(android_vh_compaction_try_to_compact_pages_exit, + TP_PROTO(enum compact_result *compact_result), + TP_ARGS(compact_result)); +#endif /* _TRACE_HOOK_COMPACTION_H */ +/* This part must be outside protection */ +#include diff --git a/mm/compaction.c b/mm/compaction.c index 2d9bc2ebfadf..4fd76f427e29 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -49,6 +49,8 @@ static inline void count_compact_events(enum vm_event_item item, long delta) #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include #define block_start_pfn(pfn, order) round_down(pfn, 1UL << (order)) #define block_end_pfn(pfn, order) ALIGN((pfn) + 1, 1UL << (order)) @@ -2655,7 +2657,7 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order, || fatal_signal_pending(current)) break; } - + trace_android_vh_compaction_try_to_compact_pages_exit(&rc); return rc; } @@ -2902,6 +2904,7 @@ static void kcompactd_do_work(pg_data_t *pgdat) VM_BUG_ON(!list_empty(&cc.freepages)); VM_BUG_ON(!list_empty(&cc.migratepages)); } + trace_android_vh_compaction_exit(pgdat->node_id, cc.order, cc.highest_zoneidx); /* * Regardless of success, we are done until woken up next. But remember