[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2ca14dec-6e87-2e9a-80f7-0790f6e1f7cf@kernel.dk>
Date: Thu, 14 Jul 2022 10:45:04 -0600
From: Jens Axboe <axboe@...nel.dk>
To: Uros Bizjak <ubizjak@...il.com>, io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Pavel Begunkov <asml.silence@...il.com>
Subject: Re: [PATCH] io_uring: Use atomic_long_try_cmpxchg in __io_account_mem
On 7/14/22 10:33 AM, Uros Bizjak wrote:
> Use atomic_long_try_cmpxchg instead of
> atomic_long_cmpxchg (*ptr, old, new) == old in __io_account_mem.
> x86 CMPXCHG instruction returns success in ZF flag, so this
> change saves a compare after cmpxchg (and related move
> instruction in front of cmpxchg).
>
> Also, atomic_long_try_cmpxchg implicitly assigns old *ptr value
> to "old" when cmpxchg fails, enabling further code simplifications.
>
> No functional change intended.
This will be io_uring/rsrc.c for the for-next branches, but it'll apply
directly as that with a slight offset:
checking file io_uring/rsrc.c
Hunk #1 succeeded at 56 (offset -10448 lines).
I'll do that, thanks.
--
Jens Axboe
Powered by blists - more mailing lists