From 94e883c9a561af8b567291dd0855b8403107fc7b Mon Sep 17 00:00:00 2001 From: Fupan Li Date: Wed, 29 Nov 2017 11:58:37 +0800 Subject: [PATCH] spinlock: fix the wrong function name of arch_spin_lock It should be arch_spin_unlock instead of arch_spin_lock. Signed-off-by: Fupan Li --- SyncPrim/sync-1.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SyncPrim/sync-1.md b/SyncPrim/sync-1.md index 10f6594..9b8e317 100644 --- a/SyncPrim/sync-1.md +++ b/SyncPrim/sync-1.md @@ -371,8 +371,7 @@ Note: `cpu_relax` is simply a [NOP](https://en.wikipedia.org/wiki/NOP) instructi The `barrier` macro, called just before the function exits ensures the compiler will not to change the order of operations that access memory (more about memory barriers can be found in the kernel [documentation](https://www.kernel.org/doc/Documentation/memory-barriers.txt)). - -The `spin_unlock` operation goes through the a similar set of macros/function as `spin_lock` (disabling hardware interrupts etc.) before the `arch_spin_unlock` function is called; which simply increments `arch_spinlock->ticket->head`: +The `spin_unlock` operation goes through the all macros/function as `spin_lock`, of course with `unlock` prefix. In the end the `arch_spin_unlock` function will be called. If we will look at the implementation of the `arch_spin_unlock` function, we will see that it increases `head` of the `lock tickets` list: ```C __add(&lock->tickets.head, TICKET_LOCK_INC, UNLOCK_LOCK_PREFIX);