summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2022-11-25 08:42:02 -0800
committerPaul E. McKenney <paulmck@kernel.org>2023-01-03 17:49:22 -0800
commitefa3c40cfac0777071e30383d209534e09ee454b (patch)
treef365c91671b081b0e416353b8bfbd317c6ddad14
parent0b1182bde303dc476ea9712c2c816be2e4f0cf81 (diff)
rcu: Add test code for semaphore-like SRCU readers
This commit adds trivial test code for srcu_down_read() and srcu_up_read(). Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
-rw-r--r--kernel/rcu/update.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index a5b4abbee643..a72f98c120f0 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -555,9 +555,12 @@ struct early_boot_kfree_rcu {
static void early_boot_test_call_rcu(void)
{
static struct rcu_head head;
+ int idx;
static struct rcu_head shead;
struct early_boot_kfree_rcu *rhp;
+ idx = srcu_down_read(&early_srcu);
+ srcu_up_read(&early_srcu, idx);
call_rcu(&head, test_callback);
early_srcu_cookie = start_poll_synchronize_srcu(&early_srcu);
call_srcu(&early_srcu, &shead, test_callback);