]> pilppa.org Git - linux-2.6-omap-h63xx.git/commit
tracing/function-return-tracer: make the function return tracer lockless
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 12 Nov 2008 21:47:54 +0000 (22:47 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 12 Nov 2008 22:15:43 +0000 (23:15 +0100)
commit62d59d17a5f98edb48b171742dfa531488802f07
tree3b66d4439aa0e497a5a387ed7b4e8f08f57ee7f1
parentcb9382e5a94e54d0356d730954396c746ae66d6e
tracing/function-return-tracer: make the function return tracer lockless

Impact: remove spinlocks and irq disabling in function return tracer.

I've tried to figure out all of the race condition that could happen
when the tracer pushes or pops a return address trace to/from the
current thread_info.

Theory:

_ One thread can only execute on one cpu at a time. So this code
  doesn't need to be SMP-safe. Just drop the spinlock.

_ The only race could happen between the current thread and an
  interrupt. If an interrupt is raised, it will increase the index of
  the return stack storage and then execute until the end of the
  tracing to finally free the index it used. We don't need to disable
  irqs.

This is theorical. In practice, I've tested it with a two-core SMP and
had no problem at all. Perhaps -tip testing could confirm it.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/ftrace.c