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.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index c88d67b59394..8a7d510ffa9c 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -40,6 +40,7 @@ void percpu_counter_destroy(struct percpu_counter *fbc);
40void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 40void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
42s64 __percpu_counter_sum(struct percpu_counter *fbc); 42s64 __percpu_counter_sum(struct percpu_counter *fbc);
43int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs);
43 44
44static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 45static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
45{ 46{
@@ -98,6 +99,16 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
98 fbc->count = amount; 99 fbc->count = amount;
99} 100}
100 101
102static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
103{
104 if (fbc->count > rhs)
105 return 1;
106 else if (fbc->count < rhs)
107 return -1;
108 else
109 return 0;
110}
111
101static inline void 112static inline void
102percpu_counter_add(struct percpu_counter *fbc, s64 amount) 113percpu_counter_add(struct percpu_counter *fbc, s64 amount)
103{ 114{