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 06:07:36 +0000 (23:07 -0700)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-bp.h
urcu-call-rcu-impl.h
urcu.h

index 09ee9c9ddeed6161134fc2d26ad499fde7056202..451bedb8dd4700b2f69c788682695005ef71af36 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 b9e57cd60a2ba731a2030cd36c9b9b6c211c416e..38cc00190f018cf1afd7fac07e42bcedec484af3 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 5728c07d3ce4cac45a11e4540c6c5f3a934a6837..1ad971c7744c2fe2e92d0e0b63daaccf88a0d05f 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.026781 seconds and 4 git commands to generate.