Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/linux linux: Add cond_synchronize_rcu.



details:   https://anonhg.NetBSD.org/src/rev/511f0232ada8
branches:  trunk
changeset: 1028647:511f0232ada8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:35:17 2021 +0000

description:
linux: Add cond_synchronize_rcu.

diffstat:

 sys/external/bsd/common/include/linux/rcupdate.h |   7 +++++-
 sys/external/bsd/common/linux/linux_rcu.c        |  27 ++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 3 deletions(-)

diffs (78 lines):

diff -r 8f0197265fbb -r 511f0232ada8 sys/external/bsd/common/include/linux/rcupdate.h
--- a/sys/external/bsd/common/include/linux/rcupdate.h  Sun Dec 19 11:35:06 2021 +0000
+++ b/sys/external/bsd/common/include/linux/rcupdate.h  Sun Dec 19 11:35:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcupdate.h,v 1.6 2021/12/19 11:33:17 riastradh Exp $   */
+/*     $NetBSD: rcupdate.h,v 1.7 2021/12/19 11:35:17 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -75,8 +75,10 @@
 
 #define        _kfree_rcu              linux__kfree_rcu
 #define        call_rcu                linux_call_rcu
+#define        cond_synchronize_rcu    linux_cond_synchronize_rcu
 #define        destroy_rcu_head        linux_destroy_rcu_head
 #define        init_rcu_head           linux_init_rcu_head
+#define        get_state_synchronize_rcu linux_get_state_synchronize_rcu
 #define        rcu_barrier             linux_rcu_barrier
 #define        synchronize_rcu         linux_synchronize_rcu
 
@@ -90,6 +92,9 @@
 void   rcu_barrier(void);
 void   synchronize_rcu(void);
 
+unsigned long get_state_synchronize_rcu(void);
+void   cond_synchronize_rcu(unsigned long);
+
 void   _kfree_rcu(struct rcu_head *, void *);
 
 static inline void
diff -r 8f0197265fbb -r 511f0232ada8 sys/external/bsd/common/linux/linux_rcu.c
--- a/sys/external/bsd/common/linux/linux_rcu.c Sun Dec 19 11:35:06 2021 +0000
+++ b/sys/external/bsd/common/linux/linux_rcu.c Sun Dec 19 11:35:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_rcu.c,v 1.2 2021/12/19 11:31:04 riastradh Exp $  */
+/*     $NetBSD: linux_rcu.c,v 1.3 2021/12/19 11:35:17 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.2 2021/12/19 11:31:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.3 2021/12/19 11:35:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -96,6 +96,29 @@
 }
 
 /*
+ * cookie = get_state_synchronize_rcu(), cond_synchronize_rcu(cookie)
+ *
+ *     Optimization for synchronize_rcu -- skip if it has already
+ *     happened between get_state_synchronize_rcu and
+ *     cond_synchronize_rcu.  get_state_synchronize_rcu implies a full
+ *     SMP memory barrier (membar_sync).
+ */
+unsigned long
+get_state_synchronize_rcu(void)
+{
+
+       membar_sync();
+       return 0;
+}
+
+void
+cond_synchronize_rcu(unsigned long cookie)
+{
+
+       synchronize_rcu();
+}
+
+/*
  * rcu_barrier()
  *
  *     Wait for all pending RCU callbacks to complete.



Home | Main Index | Thread Index | Old Index