LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] locking/qspinlock: Fix typo of lock word transition in the uncontended case
@ 2021-07-15  3:08 Zenghui Yu
  2021-08-09 13:40 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: Zenghui Yu @ 2021-07-15  3:08 UTC (permalink / raw)
  To: peterz, mingo, will, longman, boqun.feng
  Cc: wanghaibin.wang, linux-kernel, Zenghui Yu

If the queue head is the only one in the queue and nobody is concurrently
setting PENDING bit, the uncontended transition should be n,0,0 -> 0,0,1.

Fix the typo.

Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
---
 kernel/locking/qspinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index cbff6ba53d56..591835415698 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -355,7 +355,7 @@ void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
 	 * If we observe contention, there is a concurrent locker.
 	 *
 	 * Undo and queue; our setting of PENDING might have made the
-	 * n,0,0 -> 0,0,0 transition fail and it will now be waiting
+	 * n,0,0 -> 0,0,1 transition fail and it will now be waiting
 	 * on @next to become !NULL.
 	 */
 	if (unlikely(val & ~_Q_LOCKED_MASK)) {
-- 
2.19.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] locking/qspinlock: Fix typo of lock word transition in the uncontended case
  2021-07-15  3:08 [PATCH] locking/qspinlock: Fix typo of lock word transition in the uncontended case Zenghui Yu
@ 2021-08-09 13:40 ` Will Deacon
  2021-08-09 16:22   ` Waiman Long
  0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2021-08-09 13:40 UTC (permalink / raw)
  To: Zenghui Yu
  Cc: peterz, mingo, longman, boqun.feng, wanghaibin.wang, linux-kernel

On Thu, Jul 15, 2021 at 11:08:47AM +0800, Zenghui Yu wrote:
> If the queue head is the only one in the queue and nobody is concurrently
> setting PENDING bit, the uncontended transition should be n,0,0 -> 0,0,1.
> 
> Fix the typo.
> 
> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
> ---
>  kernel/locking/qspinlock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
> index cbff6ba53d56..591835415698 100644
> --- a/kernel/locking/qspinlock.c
> +++ b/kernel/locking/qspinlock.c
> @@ -355,7 +355,7 @@ void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
>  	 * If we observe contention, there is a concurrent locker.
>  	 *
>  	 * Undo and queue; our setting of PENDING might have made the
> -	 * n,0,0 -> 0,0,0 transition fail and it will now be waiting
> +	 * n,0,0 -> 0,0,1 transition fail and it will now be waiting
>  	 * on @next to become !NULL.
>  	 */

I think this is an important typo fix as you're right that we don't
transition directly from having a waitqueue installed in the tail straight
to an unlocked state.

Acked-by: Will Deacon <will@kernel.org>

Then again, I acked the patch introducing this comment so what do I know?

Will

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] locking/qspinlock: Fix typo of lock word transition in the uncontended case
  2021-08-09 13:40 ` Will Deacon
@ 2021-08-09 16:22   ` Waiman Long
  0 siblings, 0 replies; 3+ messages in thread
From: Waiman Long @ 2021-08-09 16:22 UTC (permalink / raw)
  To: Will Deacon, Zenghui Yu
  Cc: peterz, mingo, boqun.feng, wanghaibin.wang, linux-kernel

On 8/9/21 9:40 AM, Will Deacon wrote:
> On Thu, Jul 15, 2021 at 11:08:47AM +0800, Zenghui Yu wrote:
>> If the queue head is the only one in the queue and nobody is concurrently
>> setting PENDING bit, the uncontended transition should be n,0,0 -> 0,0,1.
>>
>> Fix the typo.
>>
>> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
>> ---
>>   kernel/locking/qspinlock.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
>> index cbff6ba53d56..591835415698 100644
>> --- a/kernel/locking/qspinlock.c
>> +++ b/kernel/locking/qspinlock.c
>> @@ -355,7 +355,7 @@ void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
>>   	 * If we observe contention, there is a concurrent locker.
>>   	 *
>>   	 * Undo and queue; our setting of PENDING might have made the
>> -	 * n,0,0 -> 0,0,0 transition fail and it will now be waiting
>> +	 * n,0,0 -> 0,0,1 transition fail and it will now be waiting
>>   	 * on @next to become !NULL.
>>   	 */
> I think this is an important typo fix as you're right that we don't
> transition directly from having a waitqueue installed in the tail straight
> to an unlocked state.
>
> Acked-by: Will Deacon <will@kernel.org>
>
> Then again, I acked the patch introducing this comment so what do I know?

We usually focus more on the actual code than the associated comment. I 
am not surprise we may miss that. I do agree that the proposed change is 
better.

Acked-by: Waiman Long <longman@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-09 16:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15  3:08 [PATCH] locking/qspinlock: Fix typo of lock word transition in the uncontended case Zenghui Yu
2021-08-09 13:40 ` Will Deacon
2021-08-09 16:22   ` Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).