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] [day] [month] [year] [list]
Date:   Thu, 18 Aug 2022 19:14:14 +0200
From:   David Sterba <dsterba@...e.cz>
To:     Uros Bizjak <ubizjak@...il.com>
Cc:     linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>
Subject: Re: [PATCH] fs/btrfs: Use atomic_try_cmpxchg in free_extent_buffer

On Tue, Aug 09, 2022 at 06:36:33PM +0200, Uros Bizjak wrote:
> Use `atomic_try_cmpxchg(ptr, &old, new)` instead of
> `atomic_cmpxchg(ptr, old, new) == old` in free_extent_buffer. 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.
> 
> - atomic_try_cmpxchg implicitly assigns the *ptr value to &old when
>   cmpxchg fails, enabling further code simplifications.
> 
> This patch has no functional change.
> 
> Cc: Chris Mason <clm@...com>
> Cc: Josef Bacik <josef@...icpanda.com>
> Cc: David Sterba <dsterba@...e.com>
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>

It's not in a performance critical code but resulting code is slightly
more efficient. Added to misc-next, thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ