From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <48B65428.80201@domain.hid> Date: Thu, 28 Aug 2008 09:30:48 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <48B5592B.1090005@domain.hid> <48B55F7C.5030901@domain.hid> <48B56685.4060500@domain.hid> <48B570AF.4090900@domain.hid> <48B57281.2090109@domain.hid> <48B57626.8070404@domain.hid> <48B576F2.5010409@domain.hid> <48B57BE0.8000701@domain.hid> <48B57D32.60504@domain.hid> <48B599DD.6070306@domain.hid> <48B5A4AB.3030909@domain.hid> <48B5B9FC.2050900@domain.hid> <48B5DFE2.1080901@domain.hid> In-Reply-To: <48B5DFE2.1080901@domain.hid> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigC47963BBBB1678A98C84E87D" Sender: jan.kiszka@domain.hid Subject: Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners List-Id: "Xenomai life and development \(bug reports, patches, discussions\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gilles Chanteperdrix Cc: xenomai-core This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC47963BBBB1678A98C84E87D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> @@ -329,6 +326,13 @@ int pse51_mutex_timedlock_break(struct _ >> break; >> } >> } >> + if (!xnsynch_nsleepers(&mutex->synchbase)) { >> + xnarch_atomic_set >> + (mutex->owner, >> + clear_claimed >> + (xnarch_atomic_get(mutex->owner))); >> + xnsynch_set_owner(&mutex->synchbase, NULL); >> + } >> xnlock_put_irqrestore(&nklock, s); >=20 > I do not like this at all. I mean, unless I am mistaken, we loose more > than we gain, we are adding a couple of atomic, hence heavy, operations= > in a common case for handling a corner case. I still prefer emitting a > system call in the corner case. The hunk above is in the mutex' deadlock path - I wouldn't call this a common case. Moreover, we don't any expensive cmpxchg here. I haven't counted ops, but my strong feeling is that this patch actually shortens the common code paths + it safely avoids one syscall in the lock stealing case. Jan --------------enigC47963BBBB1678A98C84E87D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAki2VCgACgkQniDOoMHTA+nl6wCeOfC1eVqNgnOaiQdRTy9WXwFE BDUAni1VTz2LWRZ5bBlXn6HrBvQ9EVd9 =hdJs -----END PGP SIGNATURE----- --------------enigC47963BBBB1678A98C84E87D--