All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>, <qemu-devel@nongnu.org>
Cc: <qemu-trivial@nongnu.org>
Subject: Re: [Qemu-trivial] [PATCH] qemu-timer: remove unnecessary code
Date: Wed, 13 Jul 2016 19:40:16 +0800	[thread overview]
Message-ID: <578628A0.60400@cn.fujitsu.com> (raw)
In-Reply-To: <4b36498b-a15f-1da3-0792-40709c2c230d@redhat.com>



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 <pbonzini@redhat.com>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   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




WARNING: multiple messages have this Message-ID (diff)
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-timer: remove unnecessary code
Date: Wed, 13 Jul 2016 19:40:16 +0800	[thread overview]
Message-ID: <578628A0.60400@cn.fujitsu.com> (raw)
In-Reply-To: <4b36498b-a15f-1da3-0792-40709c2c230d@redhat.com>



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 <pbonzini@redhat.com>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   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

  reply	other threads:[~2016-07-13 11:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13  9:06 [Qemu-trivial] [PATCH] qemu-timer: remove unnecessary code Cao jin
2016-07-13  9:06 ` [Qemu-devel] " Cao jin
2016-07-13 10:21 ` [Qemu-trivial] " Paolo Bonzini
2016-07-13 10:21   ` [Qemu-devel] " Paolo Bonzini
2016-07-13 11:40   ` Cao jin [this message]
2016-07-13 11:40     ` Cao jin
2016-07-13 11:40     ` [Qemu-trivial] " Paolo Bonzini
2016-07-13 11:40       ` [Qemu-devel] " Paolo Bonzini
2016-07-13 12:13       ` [Qemu-trivial] " Cao jin
2016-07-13 12:13         ` [Qemu-devel] " Cao jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=578628A0.60400@cn.fujitsu.com \
    --to=caoj.fnst@cn.fujitsu.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.