Fix: compaction instrumentation update for 3.14.x stable kernels
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 13 Jul 2014 17:33:21 +0000 (13:33 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 11 Dec 2014 15:52:45 +0000 (10:52 -0500)
Conditional compilation introduced by lttng-modules commit

  0007344741ef65259bc52dea72259173dfbf96c0

needs to be applied to kernels 3.14.25 and up in the 3.14.x branch.

Squashed with commit 0007344741ef65259bc52dea72259173dfbf96c0 which was
originally targetting 3.16.

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Reported-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/compaction.h

index 1b237fa45ab069141e2e8b6db745daa6edb9f9bb..b6e4620b0a4373daad973792a0c995d4e06f5bcf 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/tracepoint.h>
+#include <linux/version.h>
 #include <trace/events/gfpflags.h>
 
 DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
@@ -45,6 +46,49 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
        TP_ARGS(nr_scanned, nr_taken)
 )
 
+#if LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
+       (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 +110,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 */
 
This page took 0.027562 seconds and 4 git commands to generate.