In the kernel implementation of mutex, thread owner field exists only if it is a SMP build. I can understand that under good and clean code a thread will call release only if acquire was successful so we can save some cache and cpu cycles by not keeping track of the thread. But then why does SMP require it ? Is it because in SMP the mutex is hybrid and spins while the thread owner is on another cpu and requires this field for the reference or are there more reasons behind it ?
Honestly, I don't remember linux kernel mutex implementation now, but I see at least three reasons to store mutex owner directly in the data structure: