summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2026-03-06 12:43:56 +0300
committerPeter Zijlstra <peterz@infradead.org>2026-03-08 13:06:53 +0300
commit739690915ce1f017223ef4e6f3cc966ccfa3c861 (patch)
treebf804dc3b8d146cc1ff527300f51958a347ae103 /include/linux
parent90bb681dcdf7e69c90b56a18f06c0389a0810b92 (diff)
downloadlinux-739690915ce1f017223ef4e6f3cc966ccfa3c861.tar.xz
locking/rwsem: Add context analysis
Add compiler context analysis annotations. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260306101417.GT1282955@noisy.programming.kicks-ass.net
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/rwsem.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index e7829531c4ba..6a1a7bae5f81 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -57,7 +57,7 @@ context_lock_struct(rw_semaphore) {
struct optimistic_spin_queue osq; /* spinner MCS lock */
#endif
raw_spinlock_t wait_lock;
- struct rwsem_waiter *first_waiter;
+ struct rwsem_waiter *first_waiter __guarded_by(&wait_lock);
#ifdef CONFIG_DEBUG_RWSEMS
void *magic;
#endif
@@ -131,7 +131,7 @@ do { \
*/
static inline bool rwsem_is_contended(struct rw_semaphore *sem)
{
- return sem->first_waiter != NULL;
+ return data_race(sem->first_waiter != NULL);
}
#if defined(CONFIG_DEBUG_RWSEMS) || defined(CONFIG_DETECT_HUNG_TASK_BLOCKER)