From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLpiL-0006xW-Fk for qemu-devel@nongnu.org; Thu, 12 Feb 2015 04:05:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLpiH-0006V1-CW for qemu-devel@nongnu.org; Thu, 12 Feb 2015 04:05:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLpiG-0006Ut-Vc for qemu-devel@nongnu.org; Thu, 12 Feb 2015 04:05:33 -0500 Date: Thu, 12 Feb 2015 17:05:26 +0800 From: Fam Zheng Message-ID: <20150212090526.GA10309@ad.nay.redhat.com> References: <1423674872-10676-1-git-send-email-pbonzini@redhat.com> <1423674872-10676-2-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423674872-10676-2-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/3] rcu: do not let RCU callbacks pile up indefinitely List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com On Wed, 02/11 18:14, Paolo Bonzini wrote: > Always process them within half a second. Even though waiting a little > is useful, it is not okay to delay e.g. qemu_opts_del forever. > > Signed-off-by: Paolo Bonzini > --- > util/rcu.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/util/rcu.c b/util/rcu.c > index c9c3e6e..486d7b6 100644 > --- a/util/rcu.c > +++ b/util/rcu.c > @@ -223,14 +223,16 @@ static void *call_rcu_thread(void *opaque) > * Fetch rcu_call_count now, we only must process elements that were > * added before synchronize_rcu() starts. > */ > - while (n < RCU_CALL_MIN_SIZE && ++tries <= 5) { > - g_usleep(100000); > - qemu_event_reset(&rcu_call_ready_event); > - n = atomic_read(&rcu_call_count); > - if (n < RCU_CALL_MIN_SIZE) { > - qemu_event_wait(&rcu_call_ready_event); > + while (n == 0 || (n < RCU_CALL_MIN_SIZE && ++tries <= 5)) { > + g_usleep(10000); > + if (n == 0) { > + qemu_event_reset(&rcu_call_ready_event); > n = atomic_read(&rcu_call_count); > + if (n == 0) { > + qemu_event_wait(&rcu_call_ready_event); > + } > } > + n = atomic_read(&rcu_call_count); > } > > atomic_sub(&rcu_call_count, n); Reviewed-by: Fam Zheng