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: <20220809220511.GI3600936@dread.disaster.area>
Date:   Wed, 10 Aug 2022 08:05:11 +1000
From:   Dave Chinner <david@...morbit.com>
To:     Uros Bizjak <ubizjak@...il.com>
Cc:     linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Darrick J. Wong" <djwong@...nel.org>
Subject: Re: [PATCH] fs/xfs: Use atomic64_try_cmpxchg in
 xlog_grant_{add,sub}_space

On Tue, Aug 09, 2022 at 06:56:15PM +0200, Uros Bizjak wrote:
> Use `!atomic64_try_cmpxchg(ptr, &old, new)` instead of
> `atomic64_cmpxchg(ptr, old, new) != old` in xlog_grant_{add,sub}_space.
> This has two benefits:
> 
> - The x86 cmpxchg instruction returns success in the ZF flag, so this
>   change saves a compare after cmpxchg, as well as a related move
>   instruction in the front of cmpxchg.
> 
> - atomic64_try_cmpxchg implicitly assigns the *ptr value to &old when
>   cmpxchg fails, enabling further code simplifications.

Do the two cmpxchg operations have the same memory ordering
semantics on failure?

> This patch has no functional change.

The patch looks ok, but ....

... I'm about 2 hours away from posting a patchset that completely
removes the cmpxchg and the new grant head accounting has
significantly lower fast path overhead. It also opens the door for
tracking more than 2GB of log space in the grant heads.

So I don't think we need to be micro-optimising this code given that
there are much bigger perf gains about to land...

Cheers,

Dave.
-- 
Dave Chinner
david@...morbit.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ