[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <99c720a9-b042-46d3-8182-cb9bcabb89db@suse.com>
Date: Thu, 11 Apr 2024 15:39:35 +0200
From: Jürgen Groß <jgross@...e.com>
To: Uros Bizjak <ubizjak@...il.com>, xen-devel@...ts.xenproject.org,
x86@...nel.org, linux-kernel@...r.kernel.org
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...nel.org>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] locking/x86/xen: Use try_cmpxchg() in
xen_alloc_p2m_entry()
On 05.04.24 10:32, Uros Bizjak wrote:
> Use try_cmpxchg() instead of cmpxchg(*ptr, old, new) == old.
>
> The x86 CMPXCHG instruction returns success in the ZF flag,
> so this change saves a compare after CMPXCHG.
>
> Also, try_cmpxchg() implicitly assigns old *ptr value to "old"
> when CMPXCHG fails. There is no need to explicitly assign
> old *ptr value to the temporary, which can simplify the
> surrounding source code.
>
> No functional change intended.
>
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
> Cc: Juergen Gross <jgross@...e.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
Reviewed-by: Juergen Gross <jgross@...e.com>
Juergen
Powered by blists - more mailing lists