Commit d87aae2f3c8e90bd0fe03f5309b4d066b712b8ec
1 parent
4a55c1017b
Exists in
master
and in
20 other branches
switch the protection of percpu_counter list to spinlock
... making percpu_counter_destroy() non-blocking Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 7 additions and 7 deletions Side-by-side Diff
lib/percpu_counter.c
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | |
13 | 13 | #ifdef CONFIG_HOTPLUG_CPU |
14 | 14 | static LIST_HEAD(percpu_counters); |
15 | -static DEFINE_MUTEX(percpu_counters_lock); | |
15 | +static DEFINE_SPINLOCK(percpu_counters_lock); | |
16 | 16 | #endif |
17 | 17 | |
18 | 18 | #ifdef CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER |
19 | 19 | |
... | ... | @@ -123,9 +123,9 @@ |
123 | 123 | |
124 | 124 | #ifdef CONFIG_HOTPLUG_CPU |
125 | 125 | INIT_LIST_HEAD(&fbc->list); |
126 | - mutex_lock(&percpu_counters_lock); | |
126 | + spin_lock(&percpu_counters_lock); | |
127 | 127 | list_add(&fbc->list, &percpu_counters); |
128 | - mutex_unlock(&percpu_counters_lock); | |
128 | + spin_unlock(&percpu_counters_lock); | |
129 | 129 | #endif |
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | |
... | ... | @@ -139,9 +139,9 @@ |
139 | 139 | debug_percpu_counter_deactivate(fbc); |
140 | 140 | |
141 | 141 | #ifdef CONFIG_HOTPLUG_CPU |
142 | - mutex_lock(&percpu_counters_lock); | |
142 | + spin_lock(&percpu_counters_lock); | |
143 | 143 | list_del(&fbc->list); |
144 | - mutex_unlock(&percpu_counters_lock); | |
144 | + spin_unlock(&percpu_counters_lock); | |
145 | 145 | #endif |
146 | 146 | free_percpu(fbc->counters); |
147 | 147 | fbc->counters = NULL; |
... | ... | @@ -170,7 +170,7 @@ |
170 | 170 | return NOTIFY_OK; |
171 | 171 | |
172 | 172 | cpu = (unsigned long)hcpu; |
173 | - mutex_lock(&percpu_counters_lock); | |
173 | + spin_lock(&percpu_counters_lock); | |
174 | 174 | list_for_each_entry(fbc, &percpu_counters, list) { |
175 | 175 | s32 *pcount; |
176 | 176 | unsigned long flags; |
... | ... | @@ -181,7 +181,7 @@ |
181 | 181 | *pcount = 0; |
182 | 182 | raw_spin_unlock_irqrestore(&fbc->lock, flags); |
183 | 183 | } |
184 | - mutex_unlock(&percpu_counters_lock); | |
184 | + spin_unlock(&percpu_counters_lock); | |
185 | 185 | #endif |
186 | 186 | return NOTIFY_OK; |
187 | 187 | } |