Skip to content

Commit d4e287d

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
rcu-tasks: Remove open-coded one-byte cmpxchg() emulation
This commit removes the open-coded one-byte cmpxchg() emulation from rcu_trc_cmpxchg_need_qs(), replacing it with just cmpxchg() given the latter's new-found ability to handle single-byte arguments across all architectures. Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Neeraj Upadhyay <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent 0a116dc commit d4e287d

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

kernel/rcu/tasks.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,22 +1541,7 @@ static void rcu_st_need_qs(struct task_struct *t, u8 v)
15411541
*/
15421542
u8 rcu_trc_cmpxchg_need_qs(struct task_struct *t, u8 old, u8 new)
15431543
{
1544-
union rcu_special ret;
1545-
union rcu_special trs_old = READ_ONCE(t->trc_reader_special);
1546-
union rcu_special trs_new = trs_old;
1547-
1548-
if (trs_old.b.need_qs != old)
1549-
return trs_old.b.need_qs;
1550-
trs_new.b.need_qs = new;
1551-
1552-
// Although cmpxchg() appears to KCSAN to update all four bytes,
1553-
// only the .b.need_qs byte actually changes.
1554-
instrument_atomic_read_write(&t->trc_reader_special.b.need_qs,
1555-
sizeof(t->trc_reader_special.b.need_qs));
1556-
// Avoid false-positive KCSAN failures.
1557-
ret.s = data_race(cmpxchg(&t->trc_reader_special.s, trs_old.s, trs_new.s));
1558-
1559-
return ret.b.need_qs;
1544+
return cmpxchg(&t->trc_reader_special.b.need_qs, old, new);
15601545
}
15611546
EXPORT_SYMBOL_GPL(rcu_trc_cmpxchg_need_qs);
15621547

0 commit comments

Comments
 (0)