From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 05/11] qspinlock: Optimize for smaller NR_CPUS Date: Mon, 7 Jul 2014 17:35:52 +0200 Message-ID: <20140707153552.GE19379__36660.9661643908$1404747510$gmane$org@twins.programming.kicks-ass.net> References: <20140615124657.264658593@chello.nl> <20140615130153.483502389@chello.nl> <53A17A88.7090705@redhat.com> <20140707143503.GS6758@twins.programming.kicks-ass.net> <53BAB7E1.4010506@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1615722752589152826==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X4Axg-0000kY-ND for xen-devel@lists.xenproject.org; Mon, 07 Jul 2014 15:36:12 +0000 In-Reply-To: <53BAB7E1.4010506@redhat.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: Paolo Bonzini Cc: Waiman.Long@hp.com, linux-arch@vger.kernel.org, gleb@redhat.com, kvm@vger.kernel.org, boris.ostrovsky@oracle.com, scott.norton@hp.com, raghavendra.kt@linux.vnet.ibm.com, paolo.bonzini@gmail.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, chegu_vinod@hp.com, david.vrabel@citrix.com, oleg@redhat.com, xen-devel@lists.xenproject.org, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org, mingo@kernel.org List-Id: xen-devel@lists.xenproject.org --===============1615722752589152826== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FWV58dOTQOM6W93I" Content-Disposition: inline --FWV58dOTQOM6W93I Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 07, 2014 at 05:08:17PM +0200, Paolo Bonzini wrote: > Il 07/07/2014 16:35, Peter Zijlstra ha scritto: > >On Wed, Jun 18, 2014 at 01:39:52PM +0200, Paolo Bonzini wrote: > >>Il 15/06/2014 14:47, Peter Zijlstra ha scritto: > >>> > >>>- for (;;) { > >>>- new =3D (val & ~_Q_PENDING_MASK) | _Q_LOCKED_VAL; > >>>- > >>>- old =3D atomic_cmpxchg(&lock->val, val, new); > >>>- if (old =3D=3D val) > >>>- break; > >>>- > >>>- val =3D old; > >>>- } > >>>+ clear_pending_set_locked(lock, val); > >>> return; > >> > >> > >>Might as well add clear_pending_set_locked already in patch 3. > > > >Patch 4, if anywhere. > > >=20 > This code is added in patch 3: >=20 > + /* > + * take ownership and clear the pending bit. > + * > + * *,1,0 -> *,0,1 > + */ > + for (;;) { > + new =3D (val & ~_Q_PENDING_MASK) | _Q_LOCKED_VAL; > + > + old =3D atomic_cmpxchg(&lock->val, val, new); > + if (old =3D=3D val) > + break; > + > + val =3D old; > + } > + return; >=20 > Unlike the change in patch 4, clear_pending_set_locked doesn't change how > qspinlock moves from a state to the next. True, but its where we start to break up into smaller functions. And the only reason we break them out is because we'll get different implementations depending on NR_CPUS. So we can view the breakout of xchg_tail and clear_and_set_pending as preparatory work for introducing the NR_CPUS thing. --FWV58dOTQOM6W93I Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJTur5YAAoJEHZH4aRLwOS6g3kQAKXtlRCvCSg2g2sPmw3PnenM KOImaErwG99JHISCd2HIb2apdNU0AoZ+PYUF1TtHfIK0K3ISP05z81srYDLJ8xGS A5ajSkLMF6H+cAqQdXa2H8BnuOUSJtdg5D+0hPRugjtuzOrHrow0otYIKlFJOPZ0 0Nlvr3zGg9bUTLKLBJzEN2rLAmrVTooo/07TbDf2JGpf3c95i3Z13xebLDGIoru6 HtD1yl24i6K/I8ZK6oDiiKv7JJf/QH+Zwmb1rATjITy5D4koHleWLm7k1E7Tjl3t zqSU+NU+68i18cFlZ5IRfL3W3D4lB/Hjtpeb0mZSbMN5MJKxZdmpKPz03kHEI+j5 8t2CE8cEMISyuGLSl1Q44hUrchKcdRcga52E/0VbRmL838T3j+bOzdmjPwZ8doL8 IB9yoG0+uR+TtEhgWro4f+esE6WQ6kIpAjFzBuiUVmu6gwPUsvb2XEu58bLzCsWf RTp338Vpbtb8Rafnjbj5uJlYJgFePRlFWure7CtmNgl9rhEbkJMtqcoBlK4+BLl2 W2t5melO9VI74J20x6oS1N3ZCTZxebaC/dfCVzHl3QEi1NMX4TusHHPsSV0lu+Of wvcfhaOeraRmPzvs3krCRIPvhjNIeAl/2A9jupThdM6FEh+/EoEQybEZq6YhpMfp G03clWJdHdCmzBkHpZa0 =IqHF -----END PGP SIGNATURE----- --FWV58dOTQOM6W93I-- --===============1615722752589152826== 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 --===============1615722752589152826==--