diff options
Diffstat (limited to 'include/linux/percpu_counter.h')
-rw-r--r-- | include/linux/percpu_counter.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 9007ccdfc112..a7684a513994 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h | |||
@@ -24,14 +24,18 @@ struct percpu_counter { | |||
24 | s32 *counters; | 24 | s32 *counters; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | #if NR_CPUS >= 16 | 27 | extern int percpu_counter_batch; |
28 | #define FBC_BATCH (NR_CPUS*2) | 28 | |
29 | #else | 29 | int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, |
30 | #define FBC_BATCH (NR_CPUS*4) | 30 | struct lock_class_key *key); |
31 | #endif | 31 | |
32 | #define percpu_counter_init(fbc, value) \ | ||
33 | ({ \ | ||
34 | static struct lock_class_key __key; \ | ||
35 | \ | ||
36 | __percpu_counter_init(fbc, value, &__key); \ | ||
37 | }) | ||
32 | 38 | ||
33 | int percpu_counter_init(struct percpu_counter *fbc, s64 amount); | ||
34 | int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount); | ||
35 | void percpu_counter_destroy(struct percpu_counter *fbc); | 39 | void percpu_counter_destroy(struct percpu_counter *fbc); |
36 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); | 40 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); |
37 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); | 41 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); |
@@ -39,7 +43,7 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc); | |||
39 | 43 | ||
40 | static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) | 44 | static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) |
41 | { | 45 | { |
42 | __percpu_counter_add(fbc, amount, FBC_BATCH); | 46 | __percpu_counter_add(fbc, amount, percpu_counter_batch); |
43 | } | 47 | } |
44 | 48 | ||
45 | static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) | 49 | static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) |
@@ -85,8 +89,6 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) | |||
85 | return 0; | 89 | return 0; |
86 | } | 90 | } |
87 | 91 | ||
88 | #define percpu_counter_init_irq percpu_counter_init | ||
89 | |||
90 | static inline void percpu_counter_destroy(struct percpu_counter *fbc) | 92 | static inline void percpu_counter_destroy(struct percpu_counter *fbc) |
91 | { | 93 | { |
92 | } | 94 | } |