aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/rcu.c
diff options
context:
space:
mode:
authorWedson Almeida Filho <[email protected]>2024-12-19 17:04:06 +0000
committerGreg Kroah-Hartman <[email protected]>2024-12-20 16:19:26 +0000
commit51158207294108898e5b72bb78fa51a7e848844f (patch)
tree6ff5e5addb551cf1a2b098baa72d7515708f4953 /rust/helpers/rcu.c
parentrust: implement `IdArray`, `IdTable` and `RawDeviceId` (diff)
downloadkernel-51158207294108898e5b72bb78fa51a7e848844f.tar.gz
kernel-51158207294108898e5b72bb78fa51a7e848844f.zip
rust: add rcu abstraction
Add a simple abstraction to guard critical code sections with an rcu read lock. Reviewed-by: Boqun Feng <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Co-developed-by: Danilo Krummrich <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Tested-by: Fabien Parent <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'rust/helpers/rcu.c')
-rw-r--r--rust/helpers/rcu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/helpers/rcu.c b/rust/helpers/rcu.c
new file mode 100644
index 000000000000..f1cec6583513
--- /dev/null
+++ b/rust/helpers/rcu.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/rcupdate.h>
+
+void rust_helper_rcu_read_lock(void)
+{
+ rcu_read_lock();
+}
+
+void rust_helper_rcu_read_unlock(void)
+{
+ rcu_read_unlock();
+}