lkml.org 
[lkml]   [2021]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] locking: Wire up rwlock_is_contended() on PREEMPT_RT
Date
rwlock_is_contended() should return 0 if there are no waiters pending
on that lock on, != 0 otherwise.
PREEMPT_RT's implementation of RW-locks provides
rt_rwlock_is_contended() which returns != 0 if there is a writer about
to acquire the lock. The only downside is that a writter, that is
using that function, will always see that this lock is contended even if
there are no readers or writters pending.

Wire up rwlock_is_contended() with RT's rt_rwlock_is_contended().

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/rwlock_rt.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/rwlock_rt.h b/include/linux/rwlock_rt.h
index 49c1f3842ed5b..e482671ff49ee 100644
--- a/include/linux/rwlock_rt.h
+++ b/include/linux/rwlock_rt.h
@@ -30,6 +30,7 @@ extern void rt_read_unlock(rwlock_t *rwlock);
extern void rt_write_lock(rwlock_t *rwlock);
extern int rt_write_trylock(rwlock_t *rwlock);
extern void rt_write_unlock(rwlock_t *rwlock);
+extern int rt_rwlock_is_contended(rwlock_t *rwlock);

static __always_inline void read_lock(rwlock_t *rwlock)
{
@@ -135,6 +136,6 @@ static __always_inline void write_unlock_irqrestore(rwlock_t *rwlock,
rt_write_unlock(rwlock);
}

-#define rwlock_is_contended(lock) (((void)(lock), 0))
+#define rwlock_is_contended(lock) rt_rwlock_is_contended(lock)

#endif /* __LINUX_RWLOCK_RT_H */
--
2.33.0
\
 
 \ /
  Last update: 2021-09-06 16:31    [W:0.065 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site