call_rcu: register work threads as rcu readers
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 11 Sep 2011 05:02:58 +0000 (22:02 -0700)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 11 Sep 2011 05:02:58 +0000 (22:02 -0700)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-bp.h
urcu-call-rcu-impl.h
urcu.h

index 09ee9c9..451bedb 100644 (file)
--- a/urcu-bp.h
+++ b/urcu-bp.h
@@ -114,6 +114,21 @@ static inline void rcu_init(void)
 {
 }
 
+/*
+ * Q.S. reporting are no-ops for these URCU flavors.
+ */
+static inline void rcu_quiescent_state(void)
+{
+}
+
+static inline void rcu_thread_offline(void)
+{
+}
+
+static inline void rcu_thread_online(void)
+{
+}
+
 #ifdef __cplusplus 
 }
 #endif
index b9e57cd..38cc001 100644 (file)
@@ -215,6 +215,11 @@ static void *call_rcu_thread(void *arg)
                exit(-1);
        }
 
+       /*
+        * If callbacks take a read-side lock, we need to be registered.
+        */
+       rcu_register_thread();
+
        thread_call_rcu_data = crdp;
        if (!rt) {
                uatomic_dec(&crdp->futex);
@@ -247,6 +252,7 @@ static void *call_rcu_thread(void *arg)
                }
                if (uatomic_read(&crdp->flags) & URCU_CALL_RCU_STOP)
                        break;
+               rcu_thread_offline();
                if (!rt) {
                        if (&crdp->cbs.head
                            == _CMM_LOAD_SHARED(crdp->cbs.tail)) {
@@ -264,6 +270,7 @@ static void *call_rcu_thread(void *arg)
                } else {
                        poll(NULL, 0, 10);
                }
+               rcu_thread_online();
        }
        if (!rt) {
                /*
@@ -273,6 +280,7 @@ static void *call_rcu_thread(void *arg)
                uatomic_set(&crdp->futex, 0);
        }
        uatomic_or(&crdp->flags, URCU_CALL_RCU_STOPPED);
+       rcu_unregister_thread();
        return NULL;
 }
 
diff --git a/urcu.h b/urcu.h
index 5728c07..1ad971c 100644 (file)
--- a/urcu.h
+++ b/urcu.h
@@ -107,6 +107,21 @@ extern void rcu_unregister_thread(void);
  */
 extern void rcu_init(void);
 
+/*
+ * Q.S. reporting are no-ops for these URCU flavors.
+ */
+static inline void rcu_quiescent_state(void)
+{
+}
+
+static inline void rcu_thread_offline(void)
+{
+}
+
+static inline void rcu_thread_online(void)
+{
+}
+
 #ifdef __cplusplus 
 }
 #endif
This page took 0.034823 seconds and 4 git commands to generate.