From: Lai Jiangshan Date: Thu, 29 Sep 2011 19:56:43 +0000 (-0400) Subject: urcu,call_rcu: Cleanup call_rcu_data pointers before use in child X-Git-Tag: v0.6.5~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=60af049d5e1d17e7ffdfd139bb486bd969c6a76c;p=urcu.git urcu,call_rcu: Cleanup call_rcu_data pointers before use in child [ Edit by Mathieu Desnoyers: create maxcpus_reset to handle cases where maxcpus is 0 and -1, depending on the configuration. ] Signed-off-by: Lai Jiangshan Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h index d964c47..0a47d96 100644 --- a/urcu-call-rcu-impl.h +++ b/urcu-call-rcu-impl.h @@ -88,6 +88,11 @@ static struct call_rcu_data *default_call_rcu_data; static struct call_rcu_data **per_cpu_call_rcu_data; static long maxcpus; +static void maxcpus_reset(void) +{ + maxcpus = 0; +} + /* Allocate the array if it has not already been allocated. */ static void alloc_cpu_call_rcu_data(void) @@ -123,6 +128,10 @@ static void alloc_cpu_call_rcu_data(void) static struct call_rcu_data **per_cpu_call_rcu_data = NULL; static const long maxcpus = -1; +static void maxcpus_reset(void) +{ +} + static void alloc_cpu_call_rcu_data(void) { } @@ -688,6 +697,12 @@ void call_rcu_after_fork_child(void) default_call_rcu_data = NULL; (void)get_default_call_rcu_data(); + /* Cleanup call_rcu_data pointers before use */ + maxcpus_reset(); + free(per_cpu_call_rcu_data); + per_cpu_call_rcu_data = NULL; + thread_call_rcu_data = NULL; + /* Dispose of all of the rest of the call_rcu_data structures. */ cds_list_for_each_entry_safe(crdp, next, &call_rcu_data_list, list) { if (crdp == default_call_rcu_data)