diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-13 15:38:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-13 15:38:26 -0500 |
commit | 8e9a2dba8686187d8c8179e5b86640e653963889 (patch) | |
tree | a4ba543649219cbb28d91aab65b785d763f5d069 /lib/assoc_array.c | |
parent | 6098850e7e6978f95a958f79a645a653228d0002 (diff) | |
parent | 450cbdd0125cfa5d7bbf9e2a6b6961cc48d29730 (diff) |
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core locking updates from Ingo Molnar:
"The main changes in this cycle are:
- Another attempt at enabling cross-release lockdep dependency
tracking (automatically part of CONFIG_PROVE_LOCKING=y), this time
with better performance and fewer false positives. (Byungchul Park)
- Introduce lockdep_assert_irqs_enabled()/disabled() and convert
open-coded equivalents to lockdep variants. (Frederic Weisbecker)
- Add down_read_killable() and use it in the VFS's iterate_dir()
method. (Kirill Tkhai)
- Convert remaining uses of ACCESS_ONCE() to
READ_ONCE()/WRITE_ONCE(). Most of the conversion was Coccinelle
driven. (Mark Rutland, Paul E. McKenney)
- Get rid of lockless_dereference(), by strengthening Alpha atomics,
strengthening READ_ONCE() with smp_read_barrier_depends() and thus
being able to convert users of lockless_dereference() to
READ_ONCE(). (Will Deacon)
- Various micro-optimizations:
- better PV qspinlocks (Waiman Long),
- better x86 barriers (Michael S. Tsirkin)
- better x86 refcounts (Kees Cook)
- ... plus other fixes and enhancements. (Borislav Petkov, Juergen
Gross, Miguel Bernal Marin)"
* 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits)
locking/x86: Use LOCK ADD for smp_mb() instead of MFENCE
rcu: Use lockdep to assert IRQs are disabled/enabled
netpoll: Use lockdep to assert IRQs are disabled/enabled
timers/posix-cpu-timers: Use lockdep to assert IRQs are disabled/enabled
sched/clock, sched/cputime: Use lockdep to assert IRQs are disabled/enabled
irq_work: Use lockdep to assert IRQs are disabled/enabled
irq/timings: Use lockdep to assert IRQs are disabled/enabled
perf/core: Use lockdep to assert IRQs are disabled/enabled
x86: Use lockdep to assert IRQs are disabled/enabled
smp/core: Use lockdep to assert IRQs are disabled/enabled
timers/hrtimer: Use lockdep to assert IRQs are disabled/enabled
timers/nohz: Use lockdep to assert IRQs are disabled/enabled
workqueue: Use lockdep to assert IRQs are disabled/enabled
irq/softirqs: Use lockdep to assert IRQs are disabled/enabled
locking/lockdep: Add IRQs disabled/enabled assertion APIs: lockdep_assert_irqs_enabled()/disabled()
locking/pvqspinlock: Implement hybrid PV queued/unfair locks
locking/rwlocks: Fix comments
x86/paravirt: Set up the virt_spin_lock_key after static keys get initialized
block, locking/lockdep: Assign a lock_class per gendisk used for wait_for_completion()
workqueue: Remove now redundant lock acquisitions wrt. workqueue flushes
...
Diffstat (limited to 'lib/assoc_array.c')
-rw-r--r-- | lib/assoc_array.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/assoc_array.c b/lib/assoc_array.c index 4e53be8bc590..b77d51da8c73 100644 --- a/lib/assoc_array.c +++ b/lib/assoc_array.c | |||
@@ -39,7 +39,7 @@ begin_node: | |||
39 | /* Descend through a shortcut */ | 39 | /* Descend through a shortcut */ |
40 | shortcut = assoc_array_ptr_to_shortcut(cursor); | 40 | shortcut = assoc_array_ptr_to_shortcut(cursor); |
41 | smp_read_barrier_depends(); | 41 | smp_read_barrier_depends(); |
42 | cursor = ACCESS_ONCE(shortcut->next_node); | 42 | cursor = READ_ONCE(shortcut->next_node); |
43 | } | 43 | } |
44 | 44 | ||
45 | node = assoc_array_ptr_to_node(cursor); | 45 | node = assoc_array_ptr_to_node(cursor); |
@@ -55,7 +55,7 @@ begin_node: | |||
55 | */ | 55 | */ |
56 | has_meta = 0; | 56 | has_meta = 0; |
57 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { | 57 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { |
58 | ptr = ACCESS_ONCE(node->slots[slot]); | 58 | ptr = READ_ONCE(node->slots[slot]); |
59 | has_meta |= (unsigned long)ptr; | 59 | has_meta |= (unsigned long)ptr; |
60 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { | 60 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { |
61 | /* We need a barrier between the read of the pointer | 61 | /* We need a barrier between the read of the pointer |
@@ -89,7 +89,7 @@ continue_node: | |||
89 | smp_read_barrier_depends(); | 89 | smp_read_barrier_depends(); |
90 | 90 | ||
91 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { | 91 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { |
92 | ptr = ACCESS_ONCE(node->slots[slot]); | 92 | ptr = READ_ONCE(node->slots[slot]); |
93 | if (assoc_array_ptr_is_meta(ptr)) { | 93 | if (assoc_array_ptr_is_meta(ptr)) { |
94 | cursor = ptr; | 94 | cursor = ptr; |
95 | goto begin_node; | 95 | goto begin_node; |
@@ -98,7 +98,7 @@ continue_node: | |||
98 | 98 | ||
99 | finished_node: | 99 | finished_node: |
100 | /* Move up to the parent (may need to skip back over a shortcut) */ | 100 | /* Move up to the parent (may need to skip back over a shortcut) */ |
101 | parent = ACCESS_ONCE(node->back_pointer); | 101 | parent = READ_ONCE(node->back_pointer); |
102 | slot = node->parent_slot; | 102 | slot = node->parent_slot; |
103 | if (parent == stop) | 103 | if (parent == stop) |
104 | return 0; | 104 | return 0; |
@@ -107,7 +107,7 @@ finished_node: | |||
107 | shortcut = assoc_array_ptr_to_shortcut(parent); | 107 | shortcut = assoc_array_ptr_to_shortcut(parent); |
108 | smp_read_barrier_depends(); | 108 | smp_read_barrier_depends(); |
109 | cursor = parent; | 109 | cursor = parent; |
110 | parent = ACCESS_ONCE(shortcut->back_pointer); | 110 | parent = READ_ONCE(shortcut->back_pointer); |
111 | slot = shortcut->parent_slot; | 111 | slot = shortcut->parent_slot; |
112 | if (parent == stop) | 112 | if (parent == stop) |
113 | return 0; | 113 | return 0; |
@@ -147,7 +147,7 @@ int assoc_array_iterate(const struct assoc_array *array, | |||
147 | void *iterator_data), | 147 | void *iterator_data), |
148 | void *iterator_data) | 148 | void *iterator_data) |
149 | { | 149 | { |
150 | struct assoc_array_ptr *root = ACCESS_ONCE(array->root); | 150 | struct assoc_array_ptr *root = READ_ONCE(array->root); |
151 | 151 | ||
152 | if (!root) | 152 | if (!root) |
153 | return 0; | 153 | return 0; |
@@ -194,7 +194,7 @@ assoc_array_walk(const struct assoc_array *array, | |||
194 | 194 | ||
195 | pr_devel("-->%s()\n", __func__); | 195 | pr_devel("-->%s()\n", __func__); |
196 | 196 | ||
197 | cursor = ACCESS_ONCE(array->root); | 197 | cursor = READ_ONCE(array->root); |
198 | if (!cursor) | 198 | if (!cursor) |
199 | return assoc_array_walk_tree_empty; | 199 | return assoc_array_walk_tree_empty; |
200 | 200 | ||
@@ -220,7 +220,7 @@ consider_node: | |||
220 | 220 | ||
221 | slot = segments >> (level & ASSOC_ARRAY_KEY_CHUNK_MASK); | 221 | slot = segments >> (level & ASSOC_ARRAY_KEY_CHUNK_MASK); |
222 | slot &= ASSOC_ARRAY_FAN_MASK; | 222 | slot &= ASSOC_ARRAY_FAN_MASK; |
223 | ptr = ACCESS_ONCE(node->slots[slot]); | 223 | ptr = READ_ONCE(node->slots[slot]); |
224 | 224 | ||
225 | pr_devel("consider slot %x [ix=%d type=%lu]\n", | 225 | pr_devel("consider slot %x [ix=%d type=%lu]\n", |
226 | slot, level, (unsigned long)ptr & 3); | 226 | slot, level, (unsigned long)ptr & 3); |
@@ -294,7 +294,7 @@ follow_shortcut: | |||
294 | } while (sc_level < shortcut->skip_to_level); | 294 | } while (sc_level < shortcut->skip_to_level); |
295 | 295 | ||
296 | /* The shortcut matches the leaf's index to this point. */ | 296 | /* The shortcut matches the leaf's index to this point. */ |
297 | cursor = ACCESS_ONCE(shortcut->next_node); | 297 | cursor = READ_ONCE(shortcut->next_node); |
298 | if (((level ^ sc_level) & ~ASSOC_ARRAY_KEY_CHUNK_MASK) != 0) { | 298 | if (((level ^ sc_level) & ~ASSOC_ARRAY_KEY_CHUNK_MASK) != 0) { |
299 | level = sc_level; | 299 | level = sc_level; |
300 | goto jumped; | 300 | goto jumped; |
@@ -337,7 +337,7 @@ void *assoc_array_find(const struct assoc_array *array, | |||
337 | * the terminal node. | 337 | * the terminal node. |
338 | */ | 338 | */ |
339 | for (slot = 0; slot < ASSOC_ARRAY_FAN_OUT; slot++) { | 339 | for (slot = 0; slot < ASSOC_ARRAY_FAN_OUT; slot++) { |
340 | ptr = ACCESS_ONCE(node->slots[slot]); | 340 | ptr = READ_ONCE(node->slots[slot]); |
341 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { | 341 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { |
342 | /* We need a barrier between the read of the pointer | 342 | /* We need a barrier between the read of the pointer |
343 | * and dereferencing the pointer - but only if we are | 343 | * and dereferencing the pointer - but only if we are |