aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace/events/compaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace/events/compaction.h')
-rw-r--r--include/trace/events/compaction.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 06f544ef2f6f..c6814b917bdf 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -5,6 +5,7 @@
5#define _TRACE_COMPACTION_H 5#define _TRACE_COMPACTION_H
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/list.h>
8#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
9#include <trace/events/gfpflags.h> 10#include <trace/events/gfpflags.h>
10 11
@@ -47,10 +48,11 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
47 48
48TRACE_EVENT(mm_compaction_migratepages, 49TRACE_EVENT(mm_compaction_migratepages,
49 50
50 TP_PROTO(unsigned long nr_migrated, 51 TP_PROTO(unsigned long nr_all,
51 unsigned long nr_failed), 52 int migrate_rc,
53 struct list_head *migratepages),
52 54
53 TP_ARGS(nr_migrated, nr_failed), 55 TP_ARGS(nr_all, migrate_rc, migratepages),
54 56
55 TP_STRUCT__entry( 57 TP_STRUCT__entry(
56 __field(unsigned long, nr_migrated) 58 __field(unsigned long, nr_migrated)
@@ -58,7 +60,22 @@ TRACE_EVENT(mm_compaction_migratepages,
58 ), 60 ),
59 61
60 TP_fast_assign( 62 TP_fast_assign(
61 __entry->nr_migrated = nr_migrated; 63 unsigned long nr_failed = 0;
64 struct list_head *page_lru;
65
66 /*
67 * migrate_pages() returns either a non-negative number
68 * with the number of pages that failed migration, or an
69 * error code, in which case we need to count the remaining
70 * pages manually
71 */
72 if (migrate_rc >= 0)
73 nr_failed = migrate_rc;
74 else
75 list_for_each(page_lru, migratepages)
76 nr_failed++;
77
78 __entry->nr_migrated = nr_all - nr_failed;
62 __entry->nr_failed = nr_failed; 79 __entry->nr_failed = nr_failed;
63 ), 80 ),
64 81