The intent of the function is to wait for the current locker.sysvsem depends on this definition, i.e. a false early return can cause a corrupted semaphore state.
Thus, we don't have to worry about potential later lockers,
but we also have to ensure that the arch implementation
doesn't return a false positive for the current locker.
Signed-off-by: Chris Metcalf <cmetcalf@xxxxxxxxxx>
---
On 04/28/2015 12:24 PM, Peter Zijlstra wrote:
I think it must not return before the lock holder that is current at theGreat, that seems like a workable definition. How does this modified
time of calling releases. Anything thereafter is indeed fair game as per
your logic above.
language seem? With this definition I can actually modify the
implementation of tile's arch_raw_spin_unlock_wait() to just read
current_ticket once and just wait until it changes (assuming the
lock is, in fact, locked).
Not sure whose tree this should go through; any takers?
include/linux/spinlock.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 3e18379dfa6f..36de5fc86647 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -141,7 +141,8 @@ do { \
#endif
/**
- * raw_spin_unlock_wait - wait until the spinlock gets unlocked
+ * raw_spin_unlock_wait - wait until the lock holder that is current at the
+ * time of calling releases the lock (or return immediately if unlocked).
* @lock: the spinlock in question.
*/
#define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock)