aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Bharadwaj <abharadw@codeaurora.org>2013-07-03 10:35:02 -0700
committerRuchi Kandoi <kandoiruchi@google.com>2015-11-30 15:50:57 -0800
commit1381afbe1bca2caad1f007b3cacef0cc2b071047 (patch)
tree3f07c9d368e4fec0ce72efdc9738b62c084cbef9
parentb9b84da1c9dd7314fe6e6a8247edbc1dfd8b7c63 (diff)
tracing/sched: Add trace events to track cpu hotplug.
Add ftrace event trace_sched_cpu_hotplug to track cpu hot-add and hot-remove events. This is useful in a variety of power, performance and debug analysis scenarios. Change-Id: I5d202c7a229ffacc3aafb7cf9afee0b0ee7b0931 Signed-off-by: Arun Bharadwaj <abharadw@codeaurora.org>
-rw-r--r--include/trace/events/sched.h25
-rw-r--r--kernel/cpu.c4
2 files changed, 29 insertions, 0 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 67e1bbf83695..e966e1f203e5 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -179,6 +179,31 @@ TRACE_EVENT(sched_migrate_task,
__entry->orig_cpu, __entry->dest_cpu)
);
+/*
+ * Tracepoint for a CPU going offline/online:
+ */
+TRACE_EVENT(sched_cpu_hotplug,
+
+ TP_PROTO(int affected_cpu, int error, int status),
+
+ TP_ARGS(affected_cpu, error, status),
+
+ TP_STRUCT__entry(
+ __field( int, affected_cpu )
+ __field( int, error )
+ __field( int, status )
+ ),
+
+ TP_fast_assign(
+ __entry->affected_cpu = affected_cpu;
+ __entry->error = error;
+ __entry->status = status;
+ ),
+
+ TP_printk("cpu %d %s error=%d", __entry->affected_cpu,
+ __entry->status ? "online" : "offline", __entry->error)
+);
+
DECLARE_EVENT_CLASS(sched_process_template,
TP_PROTO(struct task_struct *p),
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 2434ed358ee7..74998a32a031 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -20,6 +20,8 @@
#include <linux/gfp.h>
#include <linux/suspend.h>
+#include <trace/events/sched.h>
+
#include "smpboot.h"
#ifdef CONFIG_SMP
@@ -357,6 +359,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
out_release:
cpu_hotplug_done();
+ trace_sched_cpu_hotplug(cpu, err, 0);
if (!err)
cpu_notify_nofail(CPU_POST_DEAD | mod, hcpu);
return err;
@@ -432,6 +435,7 @@ out_notify:
__cpu_notify(CPU_UP_CANCELED | mod, hcpu, nr_calls, NULL);
out:
cpu_hotplug_done();
+ trace_sched_cpu_hotplug(cpu, ret, 1);
return ret;
}