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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zu2D0AamCdaTUUhZ@infradead.org>
Date: Fri, 20 Sep 2024 07:16:48 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Uros Bizjak <ubizjak@...il.com>
Cc: linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
	Chandan Babu R <chandan.babu@...cle.com>,
	"Darrick J. Wong" <djwong@...nel.org>
Subject: Re: [PATCH] xfs: Use try_cmpxchg() in xlog_cil_insert_pcp_aggregate()

On Thu, Sep 19, 2024 at 10:14:05AM +0200, Uros Bizjak wrote:
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -171,13 +171,12 @@ xlog_cil_insert_pcp_aggregate(
>  	 * structures that could have a nonzero space_used.
>  	 */
>  	for_each_cpu(cpu, &ctx->cil_pcpmask) {
> -		int	old, prev;
> +		int	old;
>  
>  		cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
> +		old = READ_ONCE(cilpcp->space_used);

Maybe it is just me, but this would probably look nicer if the cilpcp
variable moved into the loop scope, and both were initialized at
declaration time:

		struct xlog_cil_pcp	*cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
		int			old = READ_ONCE(cilpcp->space_used);


>  		do {
> +		} while (!try_cmpxchg(&cilpcp->space_used, &old, 0));

And this also looks a bit odd.  Again, probably preference, but a:

		while (!try_cmpxchg(&cilpcp->space_used, &old, 0))
			;

looks somewhat more normal (although still not pretty).

Sorry for not having anything more substantial to see, but the diff
just looked a bit odd..


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ