Skip to content
  • Frederic Weisbecker's avatar
    lockstat: Make lockstat counting per cpu · bd6d29c2
    Frederic Weisbecker authored
    
    
    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: default avatarSteven Rostedt <rostedt@goodmis.org>
    Signed-off-by: default avatarFrederic 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: default avatarIngo Molnar <mingo@elte.hu>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    bd6d29c2