aboutsummaryrefslogtreecommitdiffstats
path: root/lib/percpu_counter.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:10:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:10:04 -0500
commitf94181da7192f4ed8ccb1b633ea4ce56954df130 (patch)
tree2e28785f2df447573a11fbdd611dc19eb3fcb794 /lib/percpu_counter.c
parent932adbed6d99cc373fc3433d701b3a594fea872c (diff)
parentfdbc0450df12cc9cb397f3497db4b0cad7c1a8ff (diff)
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: rcu: fix rcutorture bug rcu: eliminate synchronize_rcu_xxx macro rcu: make treercu safe for suspend and resume rcu: fix rcutree grace-period-latency bug on small systems futex: catch certain assymetric (get|put)_futex_key calls futex: make futex_(get|put)_key() calls symmetric locking, percpu counters: introduce separate lock classes swiotlb: clean up EXPORT_SYMBOL usage swiotlb: remove unnecessary declaration swiotlb: replace architecture-specific swiotlb.h with linux/swiotlb.h swiotlb: add support for systems with highmem swiotlb: store phys address in io_tlb_orig_addr array swiotlb: add hwdev to swiotlb_phys_to_bus() / swiotlb_sg_to_bus()
Diffstat (limited to 'lib/percpu_counter.c')
-rw-r--r--lib/percpu_counter.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index a60bd8046095..aeaa6d734447 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -66,11 +66,11 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc)
66} 66}
67EXPORT_SYMBOL(__percpu_counter_sum); 67EXPORT_SYMBOL(__percpu_counter_sum);
68 68
69static struct lock_class_key percpu_counter_irqsafe; 69int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
70 70 struct lock_class_key *key)
71int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
72{ 71{
73 spin_lock_init(&fbc->lock); 72 spin_lock_init(&fbc->lock);
73 lockdep_set_class(&fbc->lock, key);
74 fbc->count = amount; 74 fbc->count = amount;
75 fbc->counters = alloc_percpu(s32); 75 fbc->counters = alloc_percpu(s32);
76 if (!fbc->counters) 76 if (!fbc->counters)
@@ -82,17 +82,7 @@ int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
82#endif 82#endif
83 return 0; 83 return 0;
84} 84}
85EXPORT_SYMBOL(percpu_counter_init); 85EXPORT_SYMBOL(__percpu_counter_init);
86
87int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount)
88{
89 int err;
90
91 err = percpu_counter_init(fbc, amount);
92 if (!err)
93 lockdep_set_class(&fbc->lock, &percpu_counter_irqsafe);
94 return err;
95}
96 86
97void percpu_counter_destroy(struct percpu_counter *fbc) 87void percpu_counter_destroy(struct percpu_counter *fbc)
98{ 88{