From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 03 of 11 v4] xen: sched_credit: when picking, make sure we get an idle one, if any Date: Mon, 18 Mar 2013 15:23:04 +0100 Message-ID: <1363616584.3042.7.camel@Solace> References: <8a9328d89750c7019e02.1363314645@hit-nxdomain.opendns.com> <5142E68102000078000C5CEE@nat28.tlf.novell.com> <1363343874.3912.21.camel@Solace> <51430C4902000078000C5D9C@nat28.tlf.novell.com> <51471E90.5060104@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1925413024540298693==" Return-path: In-Reply-To: <51471E90.5060104@eu.citrix.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: George Dunlap Cc: Marcus Granado , Dan Magenheimer , Jan Beulich , AnilMadhavapeddy , Andrew Cooper , Juergen Gross , Ian Jackson , Xen-Devel , Matt Wilson , Daniel De Graaf , Ian Campbell List-Id: xen-devel@lists.xenproject.org --===============1925413024540298693== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-8LqVz7yG465UK327XqyY" --=-8LqVz7yG465UK327XqyY Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On lun, 2013-03-18 at 14:02 +0000, George Dunlap wrote: > On 15/03/13 10:55, Jan Beulich wrote: > >>>> On 15.03.13 at 11:37, Dario Faggioli wro= te: > >> On ven, 2013-03-15 at 08:14 +0000, Jan Beulich wrote: > >> Perhaps I can turn the condition into something like this: > >> > >> if ( !cpumask_test_cpu(cpu, &cpus) ) > >> cpu =3D cpumask_empty(&cpus) ? cpu : cpumask_cycle(cpu, &cpus= ); > >> > >> So that we pay the price less frequently? > > Given cpu < nr_cpu_ids before this, yes, that sounds right. Or > > you could simply switch the operands of the && in your original > > if(). Yet less expensive would be if you stored the result of > > cpumask_cycle() in another variable and copied it into "cpu" > > only if less than nr_cpu_ids. That would eliminate the need for > > cpumask_empty() altogether. >=20 > It seems to me like just switching the order would result in more=20 > readable code. >=20 > Wouldn't hurt to add "Do the quick test first" to the comment so no one= =20 > switches it back. :-) >=20 Ok, will do. Thanks, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-8LqVz7yG465UK327XqyY 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.13 (GNU/Linux) iEYEABECAAYFAlFHI0gACgkQk4XaBE3IOsSLGwCgkDTiJWqCP8H2+TV0rVMM1kDS IuwAn0zNmcgL2SBQqp+okUfzN9kRSzmX =3EWf -----END PGP SIGNATURE----- --=-8LqVz7yG465UK327XqyY-- --===============1925413024540298693== 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 --===============1925413024540298693==--