kernel/locking/osq_lock.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c index 75a6f6133866..c3a166b7900c 100644 --- a/kernel/locking/osq_lock.c +++ b/kernel/locking/osq_lock.c @@ -92,14 +92,14 @@ osq_wait_next(struct optimistic_spin_queue *lock, bool osq_lock(struct optimistic_spin_queue *lock) { - struct optimistic_spin_node *node = this_cpu_ptr(&osq_node); + struct optimistic_spin_node *node; struct optimistic_spin_node *prev, *next; int curr = encode_cpu(smp_processor_id()); int old; - node->locked = 0; - node->next = NULL; - node->cpu = curr; + this_cpu_write(osq_node.next, NULL); + this_cpu_write(osq_node.locked, 0); + this_cpu_write(osq_node.cpu, curr); /* * We need both ACQUIRE (pairs with corresponding RELEASE in @@ -112,7 +112,9 @@ bool osq_lock(struct optimistic_spin_queue *lock) return true; prev = decode_cpu(old); - node->prev = prev; + this_cpu_write(osq_node.prev, prev); + + node = this_cpu_ptr(&osq_node); /* * osq_lock() unqueue