File fix-mm_compaction_migratepages-tp.diff of Package lttng-modules.2808
From: Libor Pechacek <lpechacek@suse.cz>
Date: Mon May 19 17:16:38 PDT 2014
Subject: update mm_compaction_migratepages trace-event
Signed-off-by: Tony Jones <tonyj@suse.de>
References: none
Update mm_compaction_migratepages trace-event to reflect the following kernel
change. Unfortunately this requires double computation as declarations are not
allowed in lttng TP_fast_assign so there is no way to store 'nr_failed'
as temporary.
commit ddc38a292e3ecf1e788a31fde0ec52e4b3c78c0f
Author: Vlastimil Babka <vbabka@suse.cz>
Date: Fri May 16 13:46:41 2014 +0200
mm/compaction: do not count migratepages when unnecessary
(VM Performance).
---
instrumentation/events/lttng-module/compaction.h | 41 ++++++++++++++++++++---
1 file changed, 36 insertions(+), 5 deletions(-)
--- a/instrumentation/events/lttng-module/compaction.h
+++ b/instrumentation/events/lttng-module/compaction.h
@@ -5,6 +5,7 @@
#define _TRACE_COMPACTION_H
#include <linux/types.h>
+#include <linux/list.h>
#include <linux/tracepoint.h>
#include <trace/events/gfpflags.h>
@@ -45,12 +46,39 @@ DEFINE_EVENT(mm_compaction_isolate_templ
TP_ARGS(nr_scanned, nr_taken)
)
+#ifndef _TRACE_MM_COMPACT_DEF_
+#define _TRACE_MM_COMPACT_DEF_
+
+static inline
+unsigned long mm_compaction_get_nr_failed(int migrate_rc,
+ struct list_head *migratepages)
+{
+ unsigned long nr_failed = 0;
+ struct list_head *page_lru;
+
+ /*
+ * migrate_pages() returns either a non-negative number
+ * with the number of pages that failed migration, or an
+ * error code, in which case we need to count the remaining
+ * pages manually
+ */
+ if (migrate_rc >= 0)
+ nr_failed = migrate_rc;
+ else
+ list_for_each(page_lru, migratepages)
+ nr_failed++;
+
+ return nr_failed;
+}
+#endif /* _TRACE_MM_COMPACT_DEF_ */
+
TRACE_EVENT(mm_compaction_migratepages,
- TP_PROTO(unsigned long nr_migrated,
- unsigned long nr_failed),
+ TP_PROTO(unsigned long nr_all,
+ int migrate_rc,
+ struct list_head *migratepages),
- TP_ARGS(nr_migrated, nr_failed),
+ TP_ARGS(nr_all, migrate_rc, migratepages),
TP_STRUCT__entry(
__field(unsigned long, nr_migrated)
@@ -58,8 +86,11 @@ TRACE_EVENT(mm_compaction_migratepages,
),
TP_fast_assign(
- tp_assign(nr_migrated, nr_migrated)
- tp_assign(nr_failed, nr_failed)
+ tp_assign(nr_migrated,
+ nr_all - mm_compaction_get_nr_failed(migrate_rc,
+ migratepages))
+ tp_assign(nr_failed,
+ mm_compaction_get_nr_failed(migrate_rc, migratepages))
),
TP_printk("nr_migrated=%lu nr_failed=%lu",