mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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
This commit is contained in:
committed by
Peter Zijlstra
parent
f0b7ce22d7
commit
5e256db932
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user