diff options
| author | Marco Elver <elver@google.com> | 2025-12-19 16:40:05 +0100 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-01-05 16:43:31 +0100 |
| commit | 5e256db9325e75e9f000ddd64e4f1dbd2a6d8acd (patch) | |
| tree | cd07e90d6b060c6f6d6892d09c298e226a42e1fc | |
| parent | f0b7ce22d71810c8c11abcd912fbd6f57c2e9677 (diff) | |
kref: Add context-analysis annotations
Mark functions that conditionally acquire the passed lock.
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251219154418.3592607-17-elver@google.com
| -rw-r--r-- | include/linux/kref.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/kref.h b/include/linux/kref.h index 88e82ab1367c..9bc6abe57572 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -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); |
