public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chandan Babu R <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [PATCH] xfs: Use try_cmpxchg() in xlog_cil_insert_pcp_aggregate()
Date: Fri, 20 Sep 2024 07:16:48 -0700	[thread overview]
Message-ID: <Zu2D0AamCdaTUUhZ@infradead.org> (raw)
In-Reply-To: <20240919081432.23431-1-ubizjak@gmail.com>

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..


  reply	other threads:[~2024-09-20 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19  8:14 [PATCH] xfs: Use try_cmpxchg() in xlog_cil_insert_pcp_aggregate() Uros Bizjak
2024-09-20 14:16 ` Christoph Hellwig [this message]
2024-09-22 16:51   ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zu2D0AamCdaTUUhZ@infradead.org \
    --to=hch@infradead.org \
    --cc=chandan.babu@oracle.com \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox