From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNIQY-0005SH-Kt for qemu-devel@nongnu.org; Wed, 13 Jul 2016 07:34:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNIQU-0003kN-EQ for qemu-devel@nongnu.org; Wed, 13 Jul 2016 07:34:05 -0400 References: <1468400796-30474-1-git-send-email-caoj.fnst@cn.fujitsu.com> <4b36498b-a15f-1da3-0792-40709c2c230d@redhat.com> From: Cao jin Message-ID: <578628A0.60400@cn.fujitsu.com> Date: Wed, 13 Jul 2016 19:40:16 +0800 MIME-Version: 1.0 In-Reply-To: <4b36498b-a15f-1da3-0792-40709c2c230d@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-timer: remove unnecessary code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org On 07/13/2016 06:21 PM, Paolo Bonzini wrote: > > > On 13/07/2016 11:06, Cao jin wrote: >> When passed argument 'ns' is 0, macro DIV_ROUND_UP will return 0 also. > > It's potentially slower though. > Is it because the function in the i/o loop path, so the potentially extra arithmetical instructions matters? > Paolo > >> Cc: Paolo Bonzini >> Signed-off-by: Cao jin >> --- >> qemu-timer.c | 6 +----- >> 1 file changed, 1 insertion(+), 5 deletions(-) >> >> diff --git a/qemu-timer.c b/qemu-timer.c >> index eb22e92..cfe0893 100644 >> --- a/qemu-timer.c >> +++ b/qemu-timer.c >> @@ -285,12 +285,8 @@ int qemu_timeout_ns_to_ms(int64_t ns) >> return -1; >> } >> >> - if (!ns) { >> - return 0; >> - } >> - >> /* Always round up, because it's better to wait too long than to wait too >> - * little and effectively busy-wait >> + * short and effectively busy-wait >> */ >> ms = DIV_ROUND_UP(ns, SCALE_MS); >> >> > > > -- Yours Sincerely, Cao jin