OSDN Git Service

rcutorture: Add READ_ONCE() to rcu_torture_count and rcu_torture_batch
authorPaul E. McKenney <paulmck@kernel.org>
Sat, 4 Jan 2020 00:27:00 +0000 (16:27 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 21 Feb 2020 00:03:31 +0000 (16:03 -0800)
commitf042a436c8dc9f9cfe8ed1ee5de372697269657d
treef026309a51c6ff18e4e5f53a027f7977344dfca5
parent102c14d2f87976e8390d2cb892ccd14e3532e020
rcutorture: Add READ_ONCE() to rcu_torture_count and rcu_torture_batch

The rcutorture rcu_torture_count and rcu_torture_batch per-CPU variables
are read locklessly, so this commit adds the READ_ONCE() to a load in
order to avoid various types of compiler vandalism^Woptimization.

This data race was reported by KCSAN. Not appropriate for backporting
due to failure being unlikely and due to this being rcutorture.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/rcutorture.c