* [PATCH RT] rt: add rwsem_is_contended() definition to rwsem_rt.h
@ 2014-08-27 21:09 Clark Williams
2015-02-17 10:09 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 3+ messages in thread
From: Clark Williams @ 2014-08-27 21:09 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: LKML, RT
[-- Attachment #1: Type: text/plain, Size: 932 bytes --]
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@redhat.com>
---
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH RT] rt: add rwsem_is_contended() definition to rwsem_rt.h
2014-08-27 21:09 [PATCH RT] rt: add rwsem_is_contended() definition to rwsem_rt.h Clark Williams
@ 2015-02-17 10:09 ` Sebastian Andrzej Siewior
2015-02-17 19:08 ` Clark Williams
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2015-02-17 10:09 UTC (permalink / raw)
To: Clark Williams; +Cc: Thomas Gleixner, LKML, RT
* Clark Williams | 2014-08-27 16:09:28 [-0500]:
>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).
I see that I added rwsem_is_contended() in v3.14-rt1 which does:
|static inline int rwsem_is_contended(struct rw_semaphore *sem)
|{
| /* rt_mutex_has_waiters() */
| return !RB_EMPTY_ROOT(&sem->lock.waiters);
|}
Do you lack this in kernel prior to v3.14?
Sebastian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-17 19:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27 21:09 [PATCH RT] rt: add rwsem_is_contended() definition to rwsem_rt.h Clark Williams
2015-02-17 10:09 ` Sebastian Andrzej Siewior
2015-02-17 19:08 ` Clark Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).