Skip to content

Commit 11b8b37

Browse files
paulmckrcuurezki
authored andcommitted
rcu: Make Tiny RCU explicitly disable preemption
Because Tiny RCU is used only in kernels built with either CONFIG_PREEMPT_NONE=y or CONFIG_PREEMPT_VOLUNTARY=y, there has not been any need for TINY RCU to explicitly disable preemption. However, the prospect of lazy preemption changes that, and preemption means that the non-atomic increment in synchronize_rcu() can be preempted, with the possibility that one of the increments is lost. This could cause failures for users of the APIs that poll RCU grace periods. This commit therefore adds the needed preempt_disable() and preempt_enable() call to Tiny RCU. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Ankur Arora <ankur.a.arora@oracle.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
1 parent 3dbd865 commit 11b8b37

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

kernel/rcu/tiny.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ void synchronize_rcu(void)
153153
lock_is_held(&rcu_lock_map) ||
154154
lock_is_held(&rcu_sched_lock_map),
155155
"Illegal synchronize_rcu() in RCU read-side critical section");
156+
preempt_disable();
156157
WRITE_ONCE(rcu_ctrlblk.gp_seq, rcu_ctrlblk.gp_seq + 2);
158+
preempt_enable();
157159
}
158160
EXPORT_SYMBOL_GPL(synchronize_rcu);
159161

0 commit comments

Comments
 (0)