From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b048H-0007eG-Jd for qemu-devel@nongnu.org; Tue, 10 May 2016 05:39:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b048B-0002ju-St for qemu-devel@nongnu.org; Tue, 10 May 2016 05:39:12 -0400 Received: from mx1.parallels.com ([199.115.104.18]:50029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b048B-0002YU-Jo for qemu-devel@nongnu.org; Tue, 10 May 2016 05:39:07 -0400 References: <1462871793-31561-1-git-send-email-xiecl.fnst@cn.fujitsu.com> From: "Denis V. Lunev" Message-ID: <5731AC04.8010709@virtuozzo.com> Date: Tue, 10 May 2016 12:38:12 +0300 MIME-Version: 1.0 In-Reply-To: <1462871793-31561-1-git-send-email-xiecl.fnst@cn.fujitsu.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] rfifolock: no need to get thread identifier when nesting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Changlong Xie , qemu devel , Stefan Hajnoczi On 05/10/2016 12:16 PM, Changlong Xie wrote: > Signed-off-by: Changlong Xie > --- > util/rfifolock.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/util/rfifolock.c b/util/rfifolock.c > index c22f5fe..f406cc1 100644 > --- a/util/rfifolock.c > +++ b/util/rfifolock.c > @@ -50,6 +50,7 @@ void rfifolock_lock(RFifoLock *r) > > if (r->nesting > 0 && qemu_thread_is_self(&r->owner_thread)) { > r->tail--; /* put ticket back, we're nesting */ > + goto out; > } else { > while (ticket != r->head) { > /* Invoke optional contention callback */ > @@ -61,6 +62,7 @@ void rfifolock_lock(RFifoLock *r) > } > > qemu_thread_get_self(&r->owner_thread); > +out: > r->nesting++; > qemu_mutex_unlock(&r->lock); > } it would be better to put qemu_thread_get_self(&r->owner_thread); 2 lines up and avoid unnecessary goto