Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf/x86: Fix cmpxchg() usage in amd_put_event_constraints()

Now the return value of cmpxchg() is used to match an event. The
change removes the duplicate event comparison and traverses the list
until an event was removed. This also fixes the following warning:

arch/x86/kernel/cpu/perf_event_amd.c:170: warning: value computed is not used

Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1333643084-26776-3-git-send-email-robert.richter@amd.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Robert Richter and committed by
Ingo Molnar
5f09fc68 10c25023

+1 -3
+1 -3
arch/x86/kernel/cpu/perf_event_amd.c
··· 205 205 * when we come here 206 206 */ 207 207 for (i = 0; i < x86_pmu.num_counters; i++) { 208 - if (nb->owners[i] == event) { 209 - cmpxchg(nb->owners+i, event, NULL); 208 + if (cmpxchg(nb->owners + i, event, NULL) == event) 210 209 break; 211 - } 212 210 } 213 211 } 214 212