From mboxrd@z Thu Jan 1 00:00:00 1970 From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers) Date: Thu, 15 Sep 2011 11:21:43 -0400 Subject: [ltt-dev] [PATCH 09/10] avoid leaking crdp for failed path In-Reply-To: <3864d9d46dc3a602f50b4f33c7d277d153f2c682.1316064655.git.laijs@cn.fujitsu.com> References: <3864d9d46dc3a602f50b4f33c7d277d153f2c682.1316064655.git.laijs@cn.fujitsu.com> Message-ID: <20110915152143.GJ3813@Krystal> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > Signed-off-by: Lai Jiangshan [ Comment: now that set_cpu_call_rcu_data() is not racy and detects overwrites, we can effectively trust its return value and free the crdp if already set. ] Merged, thanks! Mathieu > --- > urcu-call-rcu-impl.h | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h > index ae93468..f9250e8 100644 > --- a/urcu-call-rcu-impl.h > +++ b/urcu-call-rcu-impl.h > @@ -522,8 +522,13 @@ int create_all_cpu_call_rcu_data(unsigned long flags) > } > call_rcu_unlock(&call_rcu_mutex); > if ((ret = set_cpu_call_rcu_data(i, crdp)) != 0) { > - /* FIXME: Leaks crdp for now. */ > - return ret; /* Can happen on race. */ > + call_rcu_data_free(crdp); > + > + /* it has been created by other thread */ > + if (ret == -EEXIST) > + continue; > + > + return ret; > } > } > return 0; > -- > 1.7.4.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com