Commit 4f89b336fd1edf0c88875d0b7fcdc288c7de903d

Authored by Paul E. McKenney
Committed by Paul E. McKenney
1 parent 70321d447a

rcu: Apply ACCESS_ONCE() to rcu_boost() return value

Both TINY_RCU's and TREE_RCU's implementations of rcu_boost() access
the ->boost_tasks and ->exp_tasks fields without preventing concurrent
changes to these fields.  This commit therefore applies ACCESS_ONCE in
order to prevent compiler mischief.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

Showing 2 changed files with 4 additions and 3 deletions Side-by-side Diff

kernel/rcutiny_plugin.h
... ... @@ -312,8 +312,8 @@
312 312 rt_mutex_lock(&mtx);
313 313 rt_mutex_unlock(&mtx); /* Keep lockdep happy. */
314 314  
315   - return rcu_preempt_ctrlblk.boost_tasks != NULL ||
316   - rcu_preempt_ctrlblk.exp_tasks != NULL;
  315 + return ACCESS_ONCE(rcu_preempt_ctrlblk.boost_tasks) != NULL ||
  316 + ACCESS_ONCE(rcu_preempt_ctrlblk.exp_tasks) != NULL;
317 317 }
318 318  
319 319 /*
kernel/rcutree_plugin.h
... ... @@ -1232,7 +1232,8 @@
1232 1232 rt_mutex_lock(&mtx); /* Side effect: boosts task t's priority. */
1233 1233 rt_mutex_unlock(&mtx); /* Keep lockdep happy. */
1234 1234  
1235   - return rnp->exp_tasks != NULL || rnp->boost_tasks != NULL;
  1235 + return ACCESS_ONCE(rnp->exp_tasks) != NULL ||
  1236 + ACCESS_ONCE(rnp->boost_tasks) != NULL;
1236 1237 }
1237 1238  
1238 1239 /*