aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/percpu_counter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/percpu_counter.h')
-rw-r--r--include/linux/percpu_counter.h22
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 27extern int percpu_counter_batch;
28#define FBC_BATCH (NR_CPUS*2) 28
29#else 29int __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
33int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
34int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
35void percpu_counter_destroy(struct percpu_counter *fbc); 39void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 40void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 41void __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
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 44static 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
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) 49static 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
90static inline void percpu_counter_destroy(struct percpu_counter *fbc) 92static inline void percpu_counter_destroy(struct percpu_counter *fbc)
91{ 93{
92} 94}