From: George Dunlap <george.dunlap@eu.citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Re: credit2 question
Date: Thu, 24 Jan 2013 09:53:52 +0000 [thread overview]
Message-ID: <510104B0.30500@eu.citrix.com> (raw)
In-Reply-To: <5101039E.4060504@eu.citrix.com>
On 24/01/13 09:49, George Dunlap wrote:
> On 24/01/13 07:40, Jan Beulich wrote:
>> George,
>>
>> I'm getting puzzled by the second c2t() invocation in
>> csched_runtime(): Why is the difference of credits being passed
>> here? Doesn't that (unless svc->credit is non-positive, i.e. in all
>> but unusual cases) guarantee time > ntime, and particularly
>> allow for negative ntime?
>
> Ah, right -- yes, if the other guys' credit is positive, "ntime" is
> guaranteed to be lower. Since c2t() involves integer division, it
> would definiteyl be good to get rid of the extra call if we can.
>
> My general principle is to make the code clear and easily readable
> first, and then do optimization afterwards -- in this case I just
> never came back and did the optimization step.
>
> Were you intending to submit a patch for this, or shall I?
If we're doing optimization, we can probably get away with doing all of
the calculation in "credit" (including the MIN/MAX checking), and then
only do the conversion if we're not at one of those set points. That
should get rid of any integer division entirely in a large number of cases.
-George
next prev parent reply other threads:[~2013-01-24 9:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 7:40 credit2 question Jan Beulich
2013-01-24 9:49 ` George Dunlap
2013-01-24 9:53 ` George Dunlap [this message]
2013-01-24 10:06 ` Jan Beulich
2013-01-24 10:07 ` George Dunlap
2013-01-24 10:42 ` Jan Beulich
2013-01-24 10:56 ` George Dunlap
2013-01-24 11:10 ` George Dunlap
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=510104B0.30500@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).