aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2011-03-16 19:04:15 -0400
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2011-03-16 19:04:15 -0400
commitc9aeb4561dbf10ec1d69d91947a24f7ba8de83e8 (patch)
tree1b4902bcd82979ba3c202c4d0a6073c4bb45355e /init
parent231e852aa20b7f5a98c5df3ddf752f8ea69f8138 (diff)
trace-clock/trace-clock-core
Trace clock core 32 to 64 bits clock extension. Extracts 64 bits tsc from a [1..32] bits counter, kept up to date by periodical timer interrupt. Lockless. It's actually a specialized version of cnt_32_to_63.h which does the following in addition : - Uses per-cpu data to keep track of counters. - It limits cache-line bouncing - I supports machines with non-synchronized TSCs. - Does not require read barriers, which can be slow on some architectures. - Supports a full 64-bits counter (well, just one bit more than 63 is not really a big deal when we talk about timestamp counters). If 2^64 is considered long enough between overflows, 2^63 is normally considered long enough too. - The periodical update of the value is insured by the infrastructure. There is no assumption that the counter is read frequently, because we cannot assume that given the events for which tracing is enabled can be dynamically selected. - Supports counters of various width (32-bits and below) by changing the HW_BITS define. What cnt_32_to_63.h does that this patch doesn't do : - It has a global counter, which removes the need to do an update periodically on _each_ cpu. This can be important in a dynamic tick system where CPUs need to sleep to save power. It is therefore well suited for systems reading a global clock expected to be _exactly_ synchronized across cores (where time can never ever go backward). Q: > do you actually use the RCU internals? or do you just reimplement an RCU > algorithm? > A: Nope, I don't use RCU internals in this code. Preempt disable seemed like the best way to handle this utterly short code path and I wanted the write side to be fast enough to be called periodically. What I do is: - Disable preemption at the read-side : it makes sure the pointer I get will point to a data structure that will never change while I am in the preempt disabled code. (see *) - I use per-cpu data to allow the read-side to be as fast as possible (only need to disable preemption, does not race against other CPUs and won't generate cache line bouncing). It also allows dealing with unsynchronized TSCs if needed. - Periodical write side : it's called from an IPI running on each CPU. (*) We expect the read-side (preempt off region) to last shorter than the interval between IPI updates so we can guarantee the data structure it uses won't be modified underneath it. Since the IPI update is launched each seconds or so (depends on the frequency of the counter we are trying to extend), it's more than ok. Changelog: - Support [1..32] bits -> 64 bits. I volountarily limit the code to use at most 32 bits of the hardware clock for performance considerations. If this is a problem it could be changed. Also, the algorithm is aimed at a 32 bits architecture. The code becomes muuuch simpler on a 64 bits arch, since we can do the updates atomically. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> CC: Nicolas Pitre <nico@cam.org> CC: Ralf Baechle <ralf@linux-mips.org> CC: benh@kernel.crashing.org CC: paulus@samba.org CC: David Miller <davem@davemloft.net> CC: Linus Torvalds <torvalds@linux-foundation.org> CC: Andrew Morton <akpm@linux-foundation.org> CC: Ingo Molnar <mingo@redhat.com> CC: Peter Zijlstra <a.p.zijlstra@chello.nl> CC: Thomas Gleixner <tglx@linutronix.de> CC: Steven Rostedt <rostedt@goodmis.org> CC: linux-arch@vger.kernel.org
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig12
1 files changed, 12 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index b22b0fee060..a95327d11bb 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -693,6 +693,18 @@ config CGROUP_MEM_RES_CTLR_SWAP_ENABLED
config HAVE_GET_CYCLES
def_bool n
+#
+# Architectures with a specialized tracing clock should select this.
+#
+config HAVE_TRACE_CLOCK
+ def_bool n
+
+#
+# Architectures with only a 32-bits clock source should select this.
+#
+config HAVE_TRACE_CLOCK_32_TO_64
+ def_bool n
+
menuconfig CGROUP_SCHED
bool "Group CPU scheduler"
depends on EXPERIMENTAL