]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/locking/osq_lock.c
locking/osq: Fix ordering of node initialisation in osq_lock
[karo-tx-linux.git] / kernel / locking / osq_lock.c
index d092a0c9c2d4ed838004215cdf038691a14f4598..05a37857ab5516012949ca64b31cff3d133c61e7 100644 (file)
@@ -93,10 +93,12 @@ bool osq_lock(struct optimistic_spin_queue *lock)
        node->cpu = curr;
 
        /*
-        * ACQUIRE semantics, pairs with corresponding RELEASE
-        * in unlock() uncontended, or fastpath.
+        * We need both ACQUIRE (pairs with corresponding RELEASE in
+        * unlock() uncontended, or fastpath) and RELEASE (to publish
+        * the node fields we just initialised) semantics when updating
+        * the lock tail.
         */
-       old = atomic_xchg_acquire(&lock->tail, curr);
+       old = atomic_xchg(&lock->tail, curr);
        if (old == OSQ_UNLOCKED_VAL)
                return true;