From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 05/24] xen: credit2: make tickling more deterministic Date: Thu, 29 Sep 2016 17:24:06 +0200 Message-ID: <1475162646.5315.11.camel@citrix.com> References: <147145358844.25877.7490417583264534196.stgit@Solace.fritz.box> <147145428827.25877.8612560340138019986.stgit@Solace.fritz.box> <57C70F80.80802@citrix.com> <1473083261.19612.54.camel@citrix.com> <6f3aec07-cdd2-f37d-2c24-5924ce02e788@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0307892309188641427==" Return-path: Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpdC5-0002Sb-VR for xen-devel@lists.xenproject.org; Thu, 29 Sep 2016 15:24:18 +0000 In-Reply-To: <6f3aec07-cdd2-f37d-2c24-5924ce02e788@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: George Dunlap , anshul makkar , xen-devel@lists.xenproject.org Cc: Andrew Cooper , Jan Beulich List-Id: xen-devel@lists.xenproject.org --===============0307892309188641427== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="=-2tw7RK5keGnya4HjNsGy" --=-2tw7RK5keGnya4HjNsGy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2016-09-13 at 12:13 +0100, George Dunlap wrote: > On 05/09/16 14:47, Dario Faggioli wrote: > > On Wed, 2016-08-31 at 18:10 +0100, anshul makkar wrote: > > > > @@ -1273,6 +1280,7 @@ csched2_alloc_vdata(const struct > > > > scheduler > > > > *ops, struct vcpu *vc, void *dd) > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0else > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{ > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0ASSERT(= svc->sdom =3D=3D NULL); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0svc->tickled_cpu = =3D svc->vcpu->vcpu_id; > > > If I understood correctly, tickled_cpu refers to pcpu and not a > > > vcpu.=C2=A0 > > > Saving vcpu_id in tickled_cpu looks wrong. > > >=20 > > Yes, and in fact, as you can see in the previous hunk, for pretty > > much > > all vcpus, tickled_cpu is initialized to -1. > >=20 > > Here, we are dealing with the vcpus of the idle domain. And for > > vcpus > > of the idle domain, their vcpu id is the same as the id of the pcpu > > they're associated to. >=20 > But what I haven't sussed out yet is why we need to initialize this > for > the idle domain at all.=C2=A0=C2=A0What benefit does it give you, and wha= t > effect > does it have? >=20 It makes things more consistent and uniform, one effect being that it is easier to manage a performance counter, for recording the number of time this 'direct tickling' mechanism has been overridden. In fact, I've tried it and, AFAICR, doing this was looking worse, when I was not initializing the field for idle vcpus. static struct csched2_vcpu * runq_candidate(struct csched2_runqueue_data *rqd, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0struct csched2_vcpu *scurr, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0int cpu, s_time_t now, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0unsigned int *pos) { =C2=A0 =C2=A0 ... =C2=A0 =C2=A0 [1] =C2=A0 =C2=A0 if ( unlikely(snext->tickled_cpu !=3D -1 && snext->tickled_cp= u !=3D cpu) ) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0SCHED_STAT_CRANK(tickled_cp= u_overridden); =C2=A0=C2=A0=C2=A0=C2=A0return snext; } In fact, it is possible to reach [1] with snext being the idle vcpu, in which case, if tickled_cpu is 0 for all of them (which would be the case, I think, if I don't init it) the counter will be incremented in a not really predictable way. That being said, initializing to -1 should work, and it's easier to read and understand (as I won't be special casing idle vcpus). So I'd go for it (and test it, of course).. what do you think? Thanks and Regards, Dario -- <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-2tw7RK5keGnya4HjNsGy 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 v2 iQIcBAABCAAGBQJX7TIYAAoJEBZCeImluHPuRpkP/i1W7XHqOnjxosneD2uGXz9L QH82x0Nt30TkpR1fLDR6ZdwMQNO+SRrZBMWjljIsZomYOoHGSAjlhSfEknonQyC7 i7bZv765DzM9z0TfE0Vomv67PHHFJm/y39mtHLbmqDaoEpbdNDNkgtLIsPDPrXIz cytzCVAUxOU829ktRrtEJgweKTo2zW0uVsKLN5uFeNNgUXhlU5ZT0UP1UGEy3UwU fGvmOaO9mrR9pW6stBvuLrEdxeCn6m5MQ33S1c6ZoRzrd8mZnepkU6IZpl2aBoIE g7xegpeJEI9CB/PLMjfUEU1NBwt0TxhJKZT1CN/B3ziOxERRk01Kj2wysMAH2jVK uncu+Y+FUxTyPTDyoYxSTHaJCPzTWHP+B/ypfymfRfxn1t6FYgJCK+0tAi31MFFx 5/tVvx/VTLMuifZ/QyMuMsjf07TllM/2B/wdooMN9h4RvrWq2AkUL57Jgi1QRL08 m6ikWBSJonqBvYT/tEYGHCP4AwLrgppTap3YlMrstXT9bbaVZ5IMjrvU83GMzdr8 TL9wOkhl+XbKxSA4gHhuGcwCbYNiwxRNLSO8RrVRoCWKGV0PHMGWaNi4aMgiB5pf ABaNx8Wb9l1kI5mZxawuEL0LRQI/NKxKO1OrDrF8xNBboo0SrwnqnE/ggpuZsce/ mgxaUmlIJZEd+VjIlFl1 =Jz4M -----END PGP SIGNATURE----- --=-2tw7RK5keGnya4HjNsGy-- --===============0307892309188641427== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============0307892309188641427==--