perf/x86/amd: Use try_cmpxchg() in events/amd/{un,}core.c
authorUros Bizjak <ubizjak@gmail.com>
Thu, 25 Apr 2024 10:16:14 +0000 (12:16 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 18 May 2024 09:15:13 +0000 (11:15 +0200)
commitcd84351c8c1baec86342d784feb884ace007d51c
tree8ccd6c21b7cd6cc44cf710e2379fb37ccaac474f
parent9d351132ed706ae24325809afa821cabf6d72568
perf/x86/amd: Use try_cmpxchg() in events/amd/{un,}core.c

Replace this pattern in events/amd/{un,}core.c:

    cmpxchg(*ptr, old, new) == old

... with the simpler and faster:

    try_cmpxchg(*ptr, &old, new)

The x86 CMPXCHG instruction returns success in the ZF flag, so this change
saves a compare after the CMPXCHG.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240425101708.5025-1-ubizjak@gmail.com
arch/x86/events/amd/core.c
arch/x86/events/amd/uncore.c