Skip to content

Commit 5e02c74

Browse files
committed
s390/cpum_sf: use READ_ONCE_ALIGNED_128() instead of 128-bit cmpxchg
Use READ_ONCE_ALIGNED_128() to read the previous value in front of a 128-bit cmpxchg loop, instead of (mis-)using a 128-bit cmpxchg operation to do the same. This makes the code more readable and is faster. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent 434b266 commit 5e02c74

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,8 +1355,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
13551355
num_sdb++;
13561356

13571357
/* Reset trailer (using compare-double-and-swap) */
1358-
/* READ_ONCE() 16 byte header */
1359-
prev.val = __cdsg(&te->header.val, 0, 0);
1358+
prev.val = READ_ONCE_ALIGNED_128(te->header.val);
13601359
do {
13611360
old.val = prev.val;
13621361
new.val = prev.val;
@@ -1558,8 +1557,7 @@ static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index,
15581557
struct hws_trailer_entry *te;
15591558

15601559
te = aux_sdb_trailer(aux, alert_index);
1561-
/* READ_ONCE() 16 byte header */
1562-
prev.val = __cdsg(&te->header.val, 0, 0);
1560+
prev.val = READ_ONCE_ALIGNED_128(te->header.val);
15631561
do {
15641562
old.val = prev.val;
15651563
new.val = prev.val;
@@ -1637,8 +1635,7 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
16371635
idx_old = idx = aux->empty_mark + 1;
16381636
for (i = 0; i < range_scan; i++, idx++) {
16391637
te = aux_sdb_trailer(aux, idx);
1640-
/* READ_ONCE() 16 byte header */
1641-
prev.val = __cdsg(&te->header.val, 0, 0);
1638+
prev.val = READ_ONCE_ALIGNED_128(te->header.val);
16421639
do {
16431640
old.val = prev.val;
16441641
new.val = prev.val;

0 commit comments

Comments
 (0)