diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-07 20:25:47 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-07 20:25:47 +0300 |
commit | c44d243fea5527077a29707bb58ff3270615d4cf (patch) | |
tree | 7f77f09ee4467af7971ee37b256a64ddb1cc8ebe /include/linux/rcuref.h | |
parent | 079ba8f46d6cc9e16385402783ca818c4bcc395b (diff) | |
parent | 105a31925e2d17b766cebcff5d173f469e7b9e52 (diff) | |
download | linux-c44d243fea5527077a29707bb58ff3270615d4cf.tar.xz |
Merge v6.12.18linux-rolling-lts
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/rcuref.h')
-rw-r--r-- | include/linux/rcuref.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h index 2c8bfd0f1b6b..6322d8c1c6b4 100644 --- a/include/linux/rcuref.h +++ b/include/linux/rcuref.h @@ -71,27 +71,30 @@ static inline __must_check bool rcuref_get(rcuref_t *ref) return rcuref_get_slowpath(ref); } -extern __must_check bool rcuref_put_slowpath(rcuref_t *ref); +extern __must_check bool rcuref_put_slowpath(rcuref_t *ref, unsigned int cnt); /* * Internal helper. Do not invoke directly. */ static __always_inline __must_check bool __rcuref_put(rcuref_t *ref) { + int cnt; + RCU_LOCKDEP_WARN(!rcu_read_lock_held() && preemptible(), "suspicious rcuref_put_rcusafe() usage"); /* * Unconditionally decrease the reference count. The saturation and * dead zones provide enough tolerance for this. */ - if (likely(!atomic_add_negative_release(-1, &ref->refcnt))) + cnt = atomic_sub_return_release(1, &ref->refcnt); + if (likely(cnt >= 0)) return false; /* * Handle the last reference drop and cases inside the saturation * and dead zones. */ - return rcuref_put_slowpath(ref); + return rcuref_put_slowpath(ref, cnt); } /** |