Commit 5e256db9 authored by Marco Elver's avatar Marco Elver Committed by Peter Zijlstra
Browse files

kref: Add context-analysis annotations



Mark functions that conditionally acquire the passed lock.

Signed-off-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251219154418.3592607-17-elver@google.com
parent f0b7ce22
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)
static inline int kref_put_mutex(struct kref *kref,
				 void (*release)(struct kref *kref),
				 struct mutex *mutex)
	__cond_acquires(true, mutex)
{
	if (refcount_dec_and_mutex_lock(&kref->refcount, mutex)) {
		release(kref);
@@ -102,6 +103,7 @@ static inline int kref_put_mutex(struct kref *kref,
static inline int kref_put_lock(struct kref *kref,
				void (*release)(struct kref *kref),
				spinlock_t *lock)
	__cond_acquires(true, lock)
{
	if (refcount_dec_and_lock(&kref->refcount, lock)) {
		release(kref);