summaryrefslogtreecommitdiff
path: root/include/linux/srcutiny.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-08-21 14:22:11 +0100
committerMark Brown <broonie@kernel.org>2026-08-21 14:22:11 +0100
commit313555b53b1feb15e79b8623e196565b5705309b (patch)
tree098fcb2771d3bbf82988aaeeb68896574a189b74 /include/linux/srcutiny.h
parent52f605e669a545a78e5294d42259b8cd7b85bbcb (diff)
parent9cc63f8bcd560c760d0b12e15bba8f81c86237cf (diff)
downloadlinux-next-313555b53b1feb15e79b8623e196565b5705309b.tar.gz
linux-next-313555b53b1feb15e79b8623e196565b5705309b.zip
Merge branch 'next' of https://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux
Diffstat (limited to 'include/linux/srcutiny.h')
-rw-r--r--include/linux/srcutiny.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h
index 905b629e8fa3..fbcf13bc12d1 100644
--- a/include/linux/srcutiny.h
+++ b/include/linux/srcutiny.h
@@ -154,4 +154,17 @@ static inline void srcu_torture_stats_print(struct srcu_struct *ssp,
data_race(READ_ONCE(ssp->srcu_idx_max)));
}
+/**
+ * srcu_readers_active - returns true if there are readers. and false otherwise.
+ * @ssp: which srcu_struct to count active readers (holding srcu_read_lock).
+ *
+ * Note that this is not an atomic primitive, and can therefore suffer
+ * severe errors when invoked on an active srcu_struct. That said, it
+ * can be useful as an error check at cleanup time.
+ */
+static inline bool srcu_readers_active(struct srcu_struct *ssp)
+{
+ return READ_ONCE(ssp->srcu_lock_nesting[0]) || READ_ONCE(ssp->srcu_lock_nesting[1]);
+}
+
#endif