Skip to content

Commit

Permalink
lockdep: Simplify debug atomic ops
Browse files Browse the repository at this point in the history
Simplify debug_atomic_inc/dec by using this_cpu_inc/dec() instead
of doing it through an indirect get_cpu_var() and a manual
incrementation.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
  • Loading branch information
fweisbec committed Apr 30, 2010
1 parent 8795d77 commit 913769f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions kernel/lockdep_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,13 @@ struct lockdep_stats {
DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);

#define debug_atomic_inc(ptr) { \
struct lockdep_stats *__cpu_lockdep_stats; \
\
WARN_ON_ONCE(!irqs_disabled()); \
__cpu_lockdep_stats = &__get_cpu_var(lockdep_stats); \
__cpu_lockdep_stats->ptr++; \
this_cpu_inc(lockdep_stats.ptr); \
}

#define debug_atomic_dec(ptr) { \
struct lockdep_stats *__cpu_lockdep_stats; \
\
WARN_ON_ONCE(!irqs_disabled()); \
__cpu_lockdep_stats = &__get_cpu_var(lockdep_stats); \
__cpu_lockdep_stats->ptr--; \
this_cpu_inc(lockdep_stats.ptr); \
}

#define debug_atomic_read(ptr) ({ \
Expand Down

0 comments on commit 913769f

Please sign in to comment.