Re: [RFC][PATCH 2/4] locking/mutex: Add context analysis

From: Bart Van Assche

Date: Wed Jan 21 2026 - 12:11:59 EST


On 1/21/26 3:07 AM, Peter Zijlstra wrote:
@@ -565,6 +574,8 @@ EXPORT_SYMBOL(mutex_unlock);
* of a unlocked mutex is not allowed.
*/
void __sched ww_mutex_unlock(struct ww_mutex *lock)
+ __releases(lock)
+ __no_context_analysis
{
__ww_mutex_unlock(lock);
mutex_unlock(&lock->base);

"__releases()" annotations should be added to the declaration of a
function only instead of the definition, isn't it?

@@ -824,22 +838,27 @@ EXPORT_SYMBOL(ww_mutex_trylock);
#ifdef CONFIG_DEBUG_LOCK_ALLOC
void __sched
mutex_lock_nested(struct mutex *lock, unsigned int subclass)
+ __acquires(lock)

Same comment here and below for the "__acquires()" annotation: I think
this annotation should be added to the function declaration only.

Thanks,

Bart.