mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 21:35:07 +00:00
s390/perf_cpum_cf: Convert to use local64_try_cmpxchg()
Convert local64_cmpxchg() usages to local64_try_cmpxchg() in order to generate slightly better code. Reviewed-by: Juergen Christ <jchrist@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
e449399ffd
commit
42898f74b2
@ -879,8 +879,8 @@ static int hw_perf_event_reset(struct perf_event *event)
|
||||
u64 prev, new;
|
||||
int err;
|
||||
|
||||
prev = local64_read(&event->hw.prev_count);
|
||||
do {
|
||||
prev = local64_read(&event->hw.prev_count);
|
||||
err = ecctr(event->hw.config, &new);
|
||||
if (err) {
|
||||
if (err != 3)
|
||||
@ -892,7 +892,7 @@ static int hw_perf_event_reset(struct perf_event *event)
|
||||
*/
|
||||
new = 0;
|
||||
}
|
||||
} while (local64_cmpxchg(&event->hw.prev_count, prev, new) != prev);
|
||||
} while (!local64_try_cmpxchg(&event->hw.prev_count, &prev, new));
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -902,12 +902,12 @@ static void hw_perf_event_update(struct perf_event *event)
|
||||
u64 prev, new, delta;
|
||||
int err;
|
||||
|
||||
prev = local64_read(&event->hw.prev_count);
|
||||
do {
|
||||
prev = local64_read(&event->hw.prev_count);
|
||||
err = ecctr(event->hw.config, &new);
|
||||
if (err)
|
||||
return;
|
||||
} while (local64_cmpxchg(&event->hw.prev_count, prev, new) != prev);
|
||||
} while (!local64_try_cmpxchg(&event->hw.prev_count, &prev, new));
|
||||
|
||||
delta = (prev <= new) ? new - prev
|
||||
: (-1ULL - prev) + new + 1; /* overflow */
|
||||
|
Loading…
x
Reference in New Issue
Block a user