diff options
author | Uros Bizjak <[email protected]> | 2023-08-07 16:51:14 +0200 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2023-10-03 21:13:23 +0200 |
commit | 1ce19bf90bd55bf54f9ed75d594029db63d395b0 (patch) | |
tree | d31c6e817c98c5ef749295fb146b1b7e16b0a084 | |
parent | de80193308f43d3ae52cd3561e8ba77cd1437311 (diff) |
perf/x86/rapl: Stop doing cpu_relax() in the local64_cmpxchg() loop in rapl_event_update()
According to the following commit:
f5fe24ef17b5 ("lockref: stop doing cpu_relax in the cmpxchg loop")
"On the x86-64 architecture even a failing cmpxchg grants exclusive
access to the cacheline, making it preferable to retry the failed op
immediately instead of stalling with the pause instruction."
Based on the above observation, remove cpu_relax() from the
local64_cmpxchg() loop of rapl_event_update().
Signed-off-by: Uros Bizjak <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
-rw-r--r-- | arch/x86/events/rapl.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c index 1579429846cc..e8f53b2590a5 100644 --- a/arch/x86/events/rapl.c +++ b/arch/x86/events/rapl.c @@ -184,10 +184,8 @@ again: rdmsrl(event->hw.event_base, new_raw_count); if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, - new_raw_count) != prev_raw_count) { - cpu_relax(); + new_raw_count) != prev_raw_count) goto again; - } /* * Now we have the new raw value and have updated the prev |