X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fcompaction.h;h=22024e9ee582856262ffcd52301182cc13744437;hb=a23635a10afbf50754da3914c712cb2b346d9250;hp=1b237fa45ab069141e2e8b6db745daa6edb9f9bb;hpb=fc5f0f1e2782b5d376e8fbe05c4505ec56c6e982;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/compaction.h b/instrumentation/events/lttng-module/compaction.h index 1b237fa4..22024e9e 100644 --- a/instrumentation/events/lttng-module/compaction.h +++ b/instrumentation/events/lttng-module/compaction.h @@ -6,6 +6,7 @@ #include #include +#include #include DECLARE_EVENT_CLASS(mm_compaction_isolate_template, @@ -45,6 +46,48 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages, TP_ARGS(nr_scanned, nr_taken) ) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) +TRACE_EVENT(mm_compaction_migratepages, + + TP_PROTO(unsigned long nr_all, + int migrate_rc, + struct list_head *migratepages), + + TP_ARGS(nr_all, migrate_rc, migratepages), + + TP_STRUCT__entry( + __field(unsigned long, nr_migrated) + __field(unsigned long, nr_failed) + ), + + TP_fast_assign( + tp_assign(nr_migrated, + nr_all - + (migrate_rc >= 0 ? migrate_rc : + ({ + unsigned long nr_failed = 0; + struct list_head *page_lru; + + list_for_each(page_lru, migratepages) + nr_failed++; + nr_failed; + }))) + tp_assign(nr_failed, + ({ + unsigned long nr_failed = 0; + struct list_head *page_lru; + + list_for_each(page_lru, migratepages) + nr_failed++; + nr_failed; + })) + ), + + TP_printk("nr_migrated=%lu nr_failed=%lu", + __entry->nr_migrated, + __entry->nr_failed) +) +#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ TRACE_EVENT(mm_compaction_migratepages, TP_PROTO(unsigned long nr_migrated, @@ -66,7 +109,7 @@ TRACE_EVENT(mm_compaction_migratepages, __entry->nr_migrated, __entry->nr_failed) ) - +#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ #endif /* _TRACE_COMPACTION_H */