aboutsummaryrefslogtreecommitdiffstats
path: root/lib/percpu_counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/percpu_counter.c')
-rw-r--r--lib/percpu_counter.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 9659eabffc31..393a0e915c23 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -124,12 +124,13 @@ static int __cpuinit percpu_counter_hotcpu_callback(struct notifier_block *nb,
124 mutex_lock(&percpu_counters_lock); 124 mutex_lock(&percpu_counters_lock);
125 list_for_each_entry(fbc, &percpu_counters, list) { 125 list_for_each_entry(fbc, &percpu_counters, list) {
126 s32 *pcount; 126 s32 *pcount;
127 unsigned long flags;
127 128
128 spin_lock(&fbc->lock); 129 spin_lock_irqsave(&fbc->lock, flags);
129 pcount = per_cpu_ptr(fbc->counters, cpu); 130 pcount = per_cpu_ptr(fbc->counters, cpu);
130 fbc->count += *pcount; 131 fbc->count += *pcount;
131 *pcount = 0; 132 *pcount = 0;
132 spin_unlock(&fbc->lock); 133 spin_unlock_irqrestore(&fbc->lock, flags);
133 } 134 }
134 mutex_unlock(&percpu_counters_lock); 135 mutex_unlock(&percpu_counters_lock);
135 return NOTIFY_OK; 136 return NOTIFY_OK;