Skip to content

Commit 1ce19bf

Browse files
ubizjakIngo Molnar
authored andcommitted
perf/x86/rapl: Stop doing cpu_relax() in the local64_cmpxchg() loop in rapl_event_update()
According to the following commit: f5fe24e ("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]
1 parent de80193 commit 1ce19bf

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/x86/events/rapl.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,8 @@ static u64 rapl_event_update(struct perf_event *event)
184184
rdmsrl(event->hw.event_base, new_raw_count);
185185

186186
if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
187-
new_raw_count) != prev_raw_count) {
188-
cpu_relax();
187+
new_raw_count) != prev_raw_count)
189188
goto again;
190-
}
191189

192190
/*
193191
* Now we have the new raw value and have updated the prev

0 commit comments

Comments
 (0)