From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBONJ-00039d-A5 for qemu-devel@nongnu.org; Mon, 19 Aug 2013 08:16:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBOND-0005V2-6V for qemu-devel@nongnu.org; Mon, 19 Aug 2013 08:15:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBONC-0005Uy-VO for qemu-devel@nongnu.org; Mon, 19 Aug 2013 08:15:51 -0400 Message-ID: <52120C44.6040305@redhat.com> Date: Mon, 19 Aug 2013 14:15:00 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1376311769-29811-1-git-send-email-stefanha@redhat.com> <1376311769-29811-3-git-send-email-stefanha@redhat.com> <20130815080124.GC22521@stefanha-thinkpad.redhat.com> <20130815120053.GA30514@stefanha-thinkpad.redhat.com> In-Reply-To: <20130815120053.GA30514@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Stefan Hajnoczi , Ping Fan Liu , liu ping fan , Alex Bligh , qemu-devel@nongnu.org Il 15/08/2013 14:00, Stefan Hajnoczi ha scritto: > The common case is that we only check the first timer in > ->active_timers. Usually the first timer has not expired yet and we > return; the lock was taken once only. > > I'm not sure it's worth complicating the case where we iterate multiple > times. I agree. Later we may try to get creative and optimize the lookup of the first timer (take the lock zero times instead of once if the first timer has not expired yet, take the lock once instead of twice if one timer runs, etc.). Anything beyond that would be premature. Paolo