summaryrefslogtreecommitdiff
path: root/include/linux/rwlock.h
diff options
context:
space:
mode:
authorBen Gardon <bgardon@google.com>2021-02-02 10:57:12 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2021-02-04 05:27:42 -0500
commit26128cb6c7e6731fe644c687af97733adfdb5ee9 (patch)
tree2f6ab60c7c1c4c020980b8fe98937915320c74a6 /include/linux/rwlock.h
parent7cca2d0b7e7d9f3cd740d41afdc00051c9b508a0 (diff)
locking/rwlocks: Add contention detection for rwlocks
rwlocks do not currently have any facility to detect contention like spinlocks do. In order to allow users of rwlocks to better manage latency, add contention detection for queued rwlocks. CC: Ingo Molnar <mingo@redhat.com> CC: Will Deacon <will@kernel.org> Acked-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Davidlohr Bueso <dbueso@suse.de> Acked-by: Waiman Long <longman@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ben Gardon <bgardon@google.com> Message-Id: <20210202185734.1680553-7-bgardon@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/linux/rwlock.h')
-rw-r--r--include/linux/rwlock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h
index 3dcd617e65ae..7ce9a51ae5c0 100644
--- a/include/linux/rwlock.h
+++ b/include/linux/rwlock.h
@@ -128,4 +128,11 @@ do { \
1 : ({ local_irq_restore(flags); 0; }); \
})
+#ifdef arch_rwlock_is_contended
+#define rwlock_is_contended(lock) \
+ arch_rwlock_is_contended(&(lock)->raw_lock)
+#else
+#define rwlock_is_contended(lock) ((void)(lock), 0)
+#endif /* arch_rwlock_is_contended */
+
#endif /* __LINUX_RWLOCK_H */