aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/percpu_counter.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-12-26 09:08:55 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-29 07:43:00 -0500
commitea319518ba3de282c13ae1cf4bf2215c5e03e67e (patch)
tree72eea2b8e5d8926e95ade18d610d59b13df5dae5 /include/linux/percpu_counter.h
parent00ef9f7348dfd2fc223ec42aceb30836e86b367f (diff)
locking, percpu counters: introduce separate lock classes
Impact: fix lockdep false positives Classify percpu_counter instances similar to regular lock objects -- that is, per instantiation site. The networking code has increased its use of percpu_counters, which leads to false positives if they are treated as a single class. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/percpu_counter.h')
-rw-r--r--include/linux/percpu_counter.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 9007ccdfc112..96bdde36599f 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -30,8 +30,16 @@ struct percpu_counter {
30#define FBC_BATCH (NR_CPUS*4) 30#define FBC_BATCH (NR_CPUS*4)
31#endif 31#endif
32 32
33int percpu_counter_init(struct percpu_counter *fbc, s64 amount); 33int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
34int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount); 34 struct lock_class_key *key);
35
36#define percpu_counter_init(fbc, value) \
37 ({ \
38 static struct lock_class_key __key; \
39 \
40 __percpu_counter_init(fbc, value, &__key); \
41 })
42
35void percpu_counter_destroy(struct percpu_counter *fbc); 43void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 44void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 45void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
@@ -85,8 +93,6 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
85 return 0; 93 return 0;
86} 94}
87 95
88#define percpu_counter_init_irq percpu_counter_init
89
90static inline void percpu_counter_destroy(struct percpu_counter *fbc) 96static inline void percpu_counter_destroy(struct percpu_counter *fbc)
91{ 97{
92} 98}