From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH] credit: track residual from divisions done during accounting Date: Fri, 22 Feb 2013 18:26:43 +0100 Message-ID: <1361554003.16232.33.camel@Solace> References: <51222E8302000078000BF1F3@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3852352388587675179==" Return-path: In-Reply-To: <51222E8302000078000BF1F3@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: George Dunlap , xen-devel List-Id: xen-devel@lists.xenproject.org --===============3852352388587675179== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-lTS40SGvF0pMKbeg+5DD" --=-lTS40SGvF0pMKbeg+5DD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2013-02-18 at 12:37 +0000, Jan Beulich wrote: > --- a/xen/common/sched_credit.c > +++ b/xen/common/sched_credit.c > > @@ -242,6 +244,7 @@ __runq_remove(struct csched_vcpu *svc) > static void burn_credits(struct csched_vcpu *svc, s_time_t now) > { > s_time_t delta; > + uint64_t val; > unsigned int credits; > =20 > /* Assert svc is current */ > @@ -250,7 +253,10 @@ static void burn_credits(struct csched_v > if ( (delta =3D now - svc->start_time) <=3D 0 ) > return; > =20 > - credits =3D (delta*CSCHED_CREDITS_PER_MSEC + MILLISECS(1)/2) / MILLI= SECS(1); > + val =3D delta * CSCHED_CREDITS_PER_MSEC + svc->residual; > + svc->residual =3D do_div(val, MILLISECS(1)); > + credits =3D val; > + ASSERT(credits =3D=3D val); I may be missing something, but how can the assert ever be false, given the assignment right before it? Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-lTS40SGvF0pMKbeg+5DD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEABECAAYFAlEnqlMACgkQk4XaBE3IOsRQlACgihS4ewwtnKp8vgxjMmsBranb g3QAnA7XsiBxiVqp2hoHEeJKcbheUYht =Ar0Y -----END PGP SIGNATURE----- --=-lTS40SGvF0pMKbeg+5DD-- --===============3852352388587675179== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============3852352388587675179==--