[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1428e38f-6dee-a162-b2e0-03604d73f889@redhat.com>
Date: Tue, 9 May 2023 11:09:57 -0400
From: Waiman Long <longman@...hat.com>
To: Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>
Cc: Boqun Feng <boqun.feng@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] locking/qspinlock: Fix state-transition changes in
comments
On 5/9/23 03:29, Qiuxu Zhuo wrote:
> 1. set_locked() only sets the locked field to 1 and doesn't touch
> 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@...el.com>
> ---
> 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);
Acked-by: Waiman Long <longman@...hat.com>
Powered by blists - more mailing lists