[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 31 Dec 2023 23:08:07 -0500
From: Waiman Long <longman@...hat.com>
To: David Laight <David.Laight@...LAB.COM>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
"'peterz@...radead.org'" <peterz@...radead.org>
Cc: "'mingo@...hat.com'" <mingo@...hat.com>,
"'will@...nel.org'" <will@...nel.org>,
"'boqun.feng@...il.com'" <boqun.feng@...il.com>,
'Linus Torvalds' <torvalds@...ux-foundation.org>,
"'virtualization@...ts.linux-foundation.org'"
<virtualization@...ts.linux-foundation.org>,
'Zeng Heng' <zengheng4@...wei.com>
Subject: Re: [PATCH next v2 1/5] locking/osq_lock: Defer clearing node->locked
until the slow osq_lock() path.
On 12/31/23 16:51, David Laight wrote:
> Since node->locked cannot be set before the assignment to prev->next
> it is save to clear it in the slow path.
>
> Signed-off-by: David Laight <david.laight@...lab.com>
> ---
> kernel/locking/osq_lock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
> index 75a6f6133866..e0bc74d85a76 100644
> --- a/kernel/locking/osq_lock.c
> +++ b/kernel/locking/osq_lock.c
> @@ -97,7 +97,6 @@ bool osq_lock(struct optimistic_spin_queue *lock)
> int curr = encode_cpu(smp_processor_id());
> int old;
>
> - node->locked = 0;
> node->next = NULL;
> node->cpu = curr;
>
> @@ -111,6 +110,7 @@ bool osq_lock(struct optimistic_spin_queue *lock)
> if (old == OSQ_UNLOCKED_VAL)
> return true;
>
> + node->locked = 0;
> prev = decode_cpu(old);
> node->prev = prev;
>
Reviewed-by: Waiman Long <longman@...hat.com>
Powered by blists - more mailing lists