From mboxrd@z Thu Jan 1 00:00:00 1970 From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers) Date: Thu, 15 Sep 2011 11:19:11 -0400 Subject: [ltt-dev] [PATCH 08/10] Return -EEXIST when the old cpu call_rcu_data has not been removed In-Reply-To: <1a8676c9f89eccb368e3f34d61f8e1e3ac242e34.1316064655.git.laijs@cn.fujitsu.com> References: <1a8676c9f89eccb368e3f34d61f8e1e3ac242e34.1316064655.git.laijs@cn.fujitsu.com> Message-ID: <20110915151911.GI3813@Krystal> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > To make it matches the comments. > > It is the caller's responsibility to use > set_cpu_call_rcu_data(cpu, NULL) to remove the CPU's > call_rcu_data structure and dispose it. Merged, thanks! Mathieu > > Signed-off-by: Lai Jiangshan > --- > urcu-call-rcu-impl.h | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h > index c822646..ae93468 100644 > --- a/urcu-call-rcu-impl.h > +++ b/urcu-call-rcu-impl.h > @@ -396,11 +396,19 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp) > errno = EINVAL; > return -EINVAL; > } > + > if (per_cpu_call_rcu_data == NULL) { > call_rcu_unlock(&call_rcu_mutex); > errno = ENOMEM; > return -ENOMEM; > } > + > + if (per_cpu_call_rcu_data[cpu] != NULL && crdp != NULL) { > + call_rcu_unlock(&call_rcu_mutex); > + errno = EEXIST; > + return -EEXIST; > + } > + > per_cpu_call_rcu_data[cpu] = crdp; > call_rcu_unlock(&call_rcu_mutex); > return 0; > -- > 1.7.4.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com