Introduce the Big Kernel Lock tracer.This new tracer lets one to observe the latencies causedby the lock_kernel() function.It captures the time when the task request the spinlock,the time when the spinlock is hold and the time it is released.This way we can measure the latency for a task that wait for thisspinlock and the latency caused by the time this lock is hold.

I will surely add some improvements like:

_ Adding a stack trace to know which function locked or unlocked the kernel._ Adding a script to get some statistics about this: which functions hold itoften, which hold it for a long time and some other things....

diff --git a/include/trace/bkl.h b/include/trace/bkl.hnew file mode 100644index 0000000..bed2f1b--- /dev/null+++ b/include/trace/bkl.h@@ -0,0 +1,29 @@+#ifndef _TRACE_BKL_H+#define _TRACE_BKL_H+++/* Entry which log the time when the task tried first to acquire the bkl+ * and the time when it acquired it.+ * That will let us know the latency to acquire the kernel lock.+ */+struct bkl_trace_acquire {+ unsigned long long acquire_req_time;+ unsigned long long acquire_time;+};++/* This will log the time when the task released the bkl.+ * So we will know the whole duration of its kernel lock.+ */+struct bkl_trace_release {+ unsigned long long release_time;+};++#ifdef CONFIG_BKL_TRACER+extern void trace_bkl_acquire(struct bkl_trace_acquire *trace);+extern void trace_bkl_release(struct bkl_trace_release *trace);+#else+static void trace_bkl_acquire(struct bkl_trace_acquire *trace) { }+static void trace_bkl_release(struct bkl_trace_release *trace) { }+#endif++#endifdiff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfigindex 396aea1..fde7700 100644--- a/kernel/trace/Kconfig+++ b/kernel/trace/Kconfig@@ -144,6 +144,17 @@ config STACK_TRACER This tracer records the max stack of the kernel, and displays it in debugfs/tracing/stack_trace