[PATCH RT] rt: add rwsem_is_contended() definition to rwsem_rt.h

From: Clark Williams
Date: Wed Aug 27 2014 - 17:09:50 EST


Thomas,

The latest btrfs code uses rwsem_is_contended() in the function
caching_thread(). On RT systems, include/linux/rwsem.h is replaced with
include/linux/rwsem_rt.h which does not provide a definition for
rwsem_is_contended(). This commit provides a definition that should
work on RT (where the lock is actually an rt_mutex).

Signed-off-by: Clark Williams <williams@xxxxxxxxxx>
---
include/linux/rwsem_rt.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/rwsem_rt.h b/include/linux/rwsem_rt.h
index e94d945c5844..77035d7abc04 100644
--- a/include/linux/rwsem_rt.h
+++ b/include/linux/rwsem_rt.h
@@ -125,4 +125,9 @@ static inline void down_write_nest_lock(struct rw_semaphore *sem,
rt_down_write_nested_lock(sem, NULL);
}
#endif
+
+static inline int rwsem_is_contended(struct rw_semaphore *sem)
+{
+ return !plist_head_empty(&sem->lock.wait_list);
+}
#endif

Attachment: signature.asc
Description: PGP signature