summaryrefslogtreecommitdiff
path: root/include/linux/srcutiny.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2024-02-15 09:04:30 -0800
committerUladzislau Rezki (Sony) <urezki@gmail.com>2024-04-15 11:29:48 +0200
commit65b4a59557f6fb5d4355093ad5a2c1bd5598ee41 (patch)
tree31a5e70e4a09cfb69d4752364a9ab58297ba4134 /include/linux/srcutiny.h
parentc1ec7c158090ab968ab9022a9f67e7d88d66ee61 (diff)
downloadlwn-65b4a59557f6fb5d4355093ad5a2c1bd5598ee41.tar.gz
lwn-65b4a59557f6fb5d4355093ad5a2c1bd5598ee41.zip
srcu: Make Tiny SRCU explicitly disable preemption
Because Tiny SRCU 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 SRCU to explicitly disable preemption. However, the prospect of lazy preemption changes that, and the lazy-preemption patches do result in rcutorture runs finding both too-short grace periods and grace-period hangs for Tiny SRCU. This commit therefore adds the needed preempt_disable() and preempt_enable() calls to Tiny SRCU. 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>
Diffstat (limited to 'include/linux/srcutiny.h')
-rw-r--r--include/linux/srcutiny.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h
index 447133171d95..4d96bbdb45f0 100644
--- a/include/linux/srcutiny.h
+++ b/include/linux/srcutiny.h
@@ -64,8 +64,10 @@ static inline int __srcu_read_lock(struct srcu_struct *ssp)
{
int idx;
+ preempt_disable(); // Needed for PREEMPT_AUTO
idx = ((READ_ONCE(ssp->srcu_idx) + 1) & 0x2) >> 1;
WRITE_ONCE(ssp->srcu_lock_nesting[idx], READ_ONCE(ssp->srcu_lock_nesting[idx]) + 1);
+ preempt_enable();
return idx;
}