[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] credit2 question

On 24/01/13 09:49, George Dunlap wrote:
On 24/01/13 07:40, Jan Beulich wrote:

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.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.