1. set_locked() only sets the locked field to 1 and doesn't touchAcked-by: Waiman Long <longman@xxxxxxxxxx>
the pending field. So the correct lock state transition is:
*,*,0 -> *,*,1
2. The initial lock state when calling clear_pending_set_locked() is
the state just after waiting for the locker goes away. So the
state transition for clear_pending_set_locked() is:
*,1,0 -> *,0,1
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>
---
v1->v2:
- Drop the state transition comments fixes (viewed from the current lock word value).
- Update the commit message accordingly.
kernel/locking/qspinlock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index ebe6b8ec7cb3..256021c87ac1 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -257,7 +257,7 @@ static __always_inline u32 queued_fetch_set_pending_acquire(struct qspinlock *lo
* set_locked - Set the lock bit and own the lock
* @lock: Pointer to queued spinlock structure
*
- * *,*,0 -> *,0,1
+ * *,*,0 -> *,*,1
*/
static __always_inline void set_locked(struct qspinlock *lock)
{
@@ -385,7 +385,7 @@ void __lockfunc queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
/*
* take ownership and clear the pending bit.
*
- * 0,1,0 -> 0,0,1
+ * *,1,0 -> *,0,1
*/
clear_pending_set_locked(lock);
lockevent_inc(lock_pending);