From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTTXy-0005jE-El for qemu-devel@nongnu.org; Tue, 08 Oct 2013 05:25:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTTXs-0006j4-CB for qemu-devel@nongnu.org; Tue, 08 Oct 2013 05:25:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTTXr-0006it-QF for qemu-devel@nongnu.org; Tue, 08 Oct 2013 05:25:36 -0400 Message-ID: <5253CF87.5040802@redhat.com> Date: Tue, 08 Oct 2013 11:25:27 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1381222058-16701-1-git-send-email-pbonzini@redhat.com> <1381222058-16701-3-git-send-email-pbonzini@redhat.com> <66EB4A83-F03E-42AF-A5B6-67A20E57D4B4@alex.org.uk> In-Reply-To: <66EB4A83-F03E-42AF-A5B6-67A20E57D4B4@alex.org.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_mod_anticipate_ns List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: qemu-devel@nongnu.org Il 08/10/2013 11:15, Alex Bligh ha scritto: > So "if we want to alter it" ... > >> > + if (ts->expire_time != -1) { >> > + timer_del_locked(timer_list, ts); >> > + } > What's this bit for? Surely you've calculated whether you are > shortening the expiry time (above), so all you need do now is > modify it. Why delete it? timer_mod_ns doesn't make this > check? timer_mod_ns_locked does not remove the timer from the list: qemu_mutex_lock(&timer_list->active_timers_lock); timer_del_locked(timer_list, ts); rearm = timer_mod_ns_locked(timer_list, ts, expire_time); qemu_mutex_unlock(&timer_list->active_timers_lock); This is doing the same. The check in the "if" is not strictly necessary, but it saves a useless visit of the list. It could be added to timer_mod_ns as well. Paolo