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); > > 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
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core