Re: [PATCH] locking/mutex: add MUTEX_WARN_ON to warn invalid mutex
From: Waiman Long
Date: Sun Sep 28 2025 - 12:37:36 EST
On 9/28/25 12:24 PM, buckzhang1212 wrote:
Hey Long
you are right,lock->magic check can help me to get what I want .
It's a bit late for me, and I want to get the warning when I first use the invalid mutex.
Can I move the lock->magic check to the mutex_lock?
All the mutex_lock*() functions will eventually call __mutex_lock_common() or __mutex_trylock_fast() which also has the check . There is no need to duplicate the check in each of them.
Cheers,
Longman