lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2899b471-b009-4bb5-bc81-19a8b8c9c955@redhat.com>
Date: Fri, 29 Dec 2023 21:54:48 -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>,
 "'xinhui.pan@...ux.vnet.ibm.com'" <xinhui.pan@...ux.vnet.ibm.com>,
 "'virtualization@...ts.linux-foundation.org'"
 <virtualization@...ts.linux-foundation.org>,
 'Zeng Heng' <zengheng4@...wei.com>
Subject: Re: [PATCH next 3/5] locking/osq_lock: Clarify osq_wait_next()


On 12/29/23 15:56, David Laight wrote:
> osq_wait_next() is passed 'prev' from osq_lock() and NULL from osq_unlock()
> but only needs the 'cpu' value to write to lock->tail.
> Just pass prev->cpu or OSQ_UNLOCKED_VAL instead.
>
> Also directly return NULL or 'next' instead of breaking the loop.
>
> Should have no effect on the generated code since gcc manages to
> assume that 'prev != NULL' due to an earlier dereference.
>
> Signed-off-by: David Laight <david.laight@...lab.com>
> ---
>   kernel/locking/osq_lock.c | 23 ++++++++++-------------
>   1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
> index 55f5db896c02..9bb3a077ba92 100644
> --- a/kernel/locking/osq_lock.c
> +++ b/kernel/locking/osq_lock.c
> @@ -48,18 +48,17 @@ static inline struct optimistic_spin_node *decode_cpu(int encoded_cpu_val)
>   static inline struct optimistic_spin_node *
>   osq_wait_next(struct optimistic_spin_queue *lock,
>   	      struct optimistic_spin_node *node,
> -	      struct optimistic_spin_node *prev)
> +	      int old)

Make the last argument name more descriptive, like "old_cpu" as the 
"int" type does not provide enough context to allow people to guess what 
"old" may be.

Cheers,
Longman



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ