mm: numa: trace tasks that fail migration due to rate limiting
authorMel Gorman <mgorman@suse.de>
Tue, 21 Jan 2014 23:51:01 +0000 (15:51 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Jan 2014 00:19:48 +0000 (16:19 -0800)
A low local/remote numa hinting fault ratio is potentially explained by
failed migrations.  This patch adds a tracepoint that fires when
migration fails due to migration rate limitation.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Alex Thorlton <athorlton@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/trace/events/migrate.h
mm/migrate.c

index ec2a6ccfd7e5445b393b2a8c7659c8862c0eb64b..3075ffbb9a830506d79991e9a0123c18058d5bc2 100644 (file)
@@ -45,6 +45,32 @@ TRACE_EVENT(mm_migrate_pages,
                __print_symbolic(__entry->reason, MIGRATE_REASON))
 );
 
+TRACE_EVENT(mm_numa_migrate_ratelimit,
+
+       TP_PROTO(struct task_struct *p, int dst_nid, unsigned long nr_pages),
+
+       TP_ARGS(p, dst_nid, nr_pages),
+
+       TP_STRUCT__entry(
+               __array(        char,           comm,   TASK_COMM_LEN)
+               __field(        pid_t,          pid)
+               __field(        int,            dst_nid)
+               __field(        unsigned long,  nr_pages)
+       ),
+
+       TP_fast_assign(
+               memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+               __entry->pid            = p->pid;
+               __entry->dst_nid        = dst_nid;
+               __entry->nr_pages       = nr_pages;
+       ),
+
+       TP_printk("comm=%s pid=%d dst_nid=%d nr_pages=%lu",
+               __entry->comm,
+               __entry->pid,
+               __entry->dst_nid,
+               __entry->nr_pages)
+);
 #endif /* _TRACE_MIGRATE_H */
 
 /* This part must be outside protection */
index 4612bb2e3677d015c839e48d6b9d96f9fb353f7e..f9e16350d09c4cf6d6c280587b4995d3102d5524 100644 (file)
@@ -1614,8 +1614,11 @@ static bool numamigrate_update_ratelimit(pg_data_t *pgdat,
                        msecs_to_jiffies(migrate_interval_millisecs);
                spin_unlock(&pgdat->numabalancing_migrate_lock);
        }
-       if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages)
+       if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages) {
+               trace_mm_numa_migrate_ratelimit(current, pgdat->node_id,
+                                                               nr_pages);
                return true;
+       }
 
        /*
         * This is an unlocked non-atomic update so errors are possible.