Commit [bd6d29] Maximize Restore History

lockstat: Make lockstat counting per cpu

Locking statistics are implemented using global atomic
variables. This is usually fine unless some path write them very
often.

This is the case for the function and function graph tracers
that disable irqs for each entry saved (except if the function
tracer is in preempt disabled only mode).
And calls to local_irq_save/restore() increment
hardirqs_on_events and hardirqs_off_events stats (or similar
stats for redundant versions).

Incrementing these global vars for each function ends up in too
much cache bouncing if lockstats are enabled.

To solve this, implement the debug_atomic_*() operations using
per cpu vars.

-v2: Use per_cpu() instead of get_cpu_var() to fetch the desired
cpu vars on debug_atomic_read()

-v3: Store the stats in a structure. No need for local_t as we
are NMI/irq safe.

-v4: Fix tons of build errors. I thought I had tested it but I
probably forgot to select the relevant config.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1270505417-8144-1-git-send-regression-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>

Frederic Weisbecker Frederic Weisbecker 2010-04-05

Ingo Molnar Ingo Molnar 2010-04-05

changed kernel/lockdep.c
changed kernel/lockdep_internals.h
changed kernel/lockdep_proc.c
kernel/lockdep.c Diff Switch to side-by-side view
Loading...
kernel/lockdep_internals.h Diff Switch to side-by-side view
Loading...
kernel/lockdep_proc.c Diff Switch to side-by-side view
Loading...