urcu,call_rcu: avoid create call_rcu_data for child when unneed
[urcu.git] / urcu-call-rcu-impl.h
index 3e947af2fd84bfd6c6843788d9f31a5ff720b876..d964c474156473c43b6bbff4f69abf5d06355e57 100644 (file)
@@ -619,7 +619,10 @@ void call_rcu_data_free(struct call_rcu_data *crdp)
                wake_call_rcu_thread(default_call_rcu_data);
        }
 
+       call_rcu_lock(&call_rcu_mutex);
        cds_list_del(&crdp->list);
+       call_rcu_unlock(&call_rcu_mutex);
+
        free(crdp);
 }
 
@@ -674,6 +677,10 @@ void call_rcu_after_fork_child(void)
        /* Release the mutex. */
        call_rcu_unlock(&call_rcu_mutex);
 
+       /* Do nothing when call_rcu() has not been used */
+       if (cds_list_empty(&call_rcu_data_list))
+               return;
+
        /*
         * Allocate a new default call_rcu_data structure in order
         * to get a working call_rcu thread to go with it.
This page took 0.023933 seconds and 4 git commands to generate.