summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlav Haugan <ohaugan@codeaurora.org>2016-06-12 13:57:05 -0700
committerOlav Haugan <ohaugan@codeaurora.org>2016-09-24 10:59:42 -0700
commit0a17b36a20d65df27ccf2de068ea517b19f6a53f (patch)
tree183d90e0b0203d8d35f89e825a2f73f45e5c0d2a
parente33c24bfecde67d7d665bfcf90c7d4c2f231be79 (diff)
sched/core: Add trace point for cpu isolation
Add tracepoint to capture the cpu isolation event including KPI for time it took to isolate. Change-Id: If2d30000f068afc50db953940f4636ef6a089b24 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
-rw-r--r--include/trace/events/sched.h35
-rw-r--r--kernel/sched/core.c12
2 files changed, 47 insertions, 0 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 1ef5ec3eaf70..3990efdd0cc0 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -1244,6 +1244,41 @@ TRACE_EVENT(sched_get_nr_running_avg,
__entry->avg, __entry->big_avg, __entry->iowait_avg)
);
+/**
+ * sched_isolate - called when cores are isolated/unisolated
+ *
+ * @acutal_mask: mask of cores actually isolated/unisolated
+ * @req_mask: mask of cores requested isolated/unisolated
+ * @online_mask: cpu online mask
+ * @time: amount of time in us it took to isolate/unisolate
+ * @isolate: 1 if isolating, 0 if unisolating
+ *
+ */
+TRACE_EVENT(sched_isolate,
+
+ TP_PROTO(unsigned int requested_cpu, unsigned int isolated_cpus,
+ u64 start_time, unsigned char isolate),
+
+ TP_ARGS(requested_cpu, isolated_cpus, start_time, isolate),
+
+ TP_STRUCT__entry(
+ __field(u32, requested_cpu)
+ __field(u32, isolated_cpus)
+ __field(u32, time)
+ __field(unsigned char, isolate)
+ ),
+
+ TP_fast_assign(
+ __entry->requested_cpu = requested_cpu;
+ __entry->isolated_cpus = isolated_cpus;
+ __entry->time = div64_u64(sched_clock() - start_time, 1000);
+ __entry->isolate = isolate;
+ ),
+
+ TP_printk("iso cpu=%u cpus=0x%x time=%u us isolated=%d",
+ __entry->requested_cpu, __entry->isolated_cpus,
+ __entry->time, __entry->isolate)
+);
#endif /* _TRACE_SCHED_H */
/* This part must be outside protection */
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cddb0073c5fb..7b7f1961fd10 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5645,6 +5645,10 @@ int sched_isolate_cpu(int cpu)
struct rq *rq = cpu_rq(cpu);
cpumask_t avail_cpus;
int ret_code = 0;
+ u64 start_time;
+
+ if (trace_sched_isolate_enabled())
+ start_time = sched_clock();
lock_device_hotplug();
@@ -5681,6 +5685,8 @@ int sched_isolate_cpu(int cpu)
out:
unlock_device_hotplug();
+ trace_sched_isolate(cpu, cpumask_bits(cpu_isolated_mask)[0],
+ start_time, 1);
return ret_code;
}
@@ -5694,6 +5700,10 @@ int sched_unisolate_cpu_unlocked(int cpu)
{
int ret_code = 0;
struct rq *rq = cpu_rq(cpu);
+ u64 start_time;
+
+ if (trace_sched_isolate_enabled())
+ start_time = sched_clock();
lock_device_hotplug_assert();
@@ -5730,6 +5740,8 @@ int sched_unisolate_cpu_unlocked(int cpu)
}
out:
+ trace_sched_isolate(cpu, cpumask_bits(cpu_isolated_mask)[0],
+ start_time, 0);
return ret_code;
}