[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2] credit2: track residual from divisions done during accounting
>>> On 26.02.13 at 18:08, George Dunlap <george.dunlap@xxxxxxxxxxxxx> wrote: > @@ -271,16 +272,24 @@ struct csched_dom { > > /* > * Time-to-credit, credit-to-time. > + * > + * We keep track of the "residual" time to make sure that frequent short > + * schedules still get accounted for in the end. > + * > * FIXME: Do pre-calculated division? > */ > -static s_time_t t2c(struct csched_runqueue_data *rqd, s_time_t time, struct > csched_vcpu *svc) > +static void t2c_update(struct csched_runqueue_data *rqd, s_time_t time, > + struct csched_vcpu *svc) > { > - return time * rqd->max_weight / svc->weight; > + uint64_t val = time * rqd->max_weight + svc->residual; > + > + svc->residual = do_div(val, svc->weight); > + svc->credit -= val; > } > > static s_time_t c2t(struct csched_runqueue_data *rqd, s_time_t credit, > struct csched_vcpu *svc) > { > - return credit * svc->weight / rqd->max_weight; > + return (credit * svc->weight) / rqd->max_weight; So you dropped the subtraction of svc->residual here - why? And if indeed intended, the insertion of parentheses here could be dropped? Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |