aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtmutex.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-06-27 05:54:57 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 20:32:47 -0400
commit0cdbee9920fb37eb2dc49b860c2b28862d647adc (patch)
treedf33dadb52979d7fadd1b464b14ae797d3838181 /kernel/rtmutex.c
parent61a87122869b6340a63b6f9f84097d3688604b90 (diff)
[PATCH] pi-futex: rt mutex futex api
Add proxy-locking rt-mutex functionality needed by pi-futexes. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/rtmutex.c')
-rw-r--r--kernel/rtmutex.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 39c8ca0cf526..3fc0f0680ca2 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -903,3 +903,58 @@ void __rt_mutex_init(struct rt_mutex *lock, const char *name)
903 debug_rt_mutex_init(lock, name); 903 debug_rt_mutex_init(lock, name);
904} 904}
905EXPORT_SYMBOL_GPL(__rt_mutex_init); 905EXPORT_SYMBOL_GPL(__rt_mutex_init);
906
907/**
908 * rt_mutex_init_proxy_locked - initialize and lock a rt_mutex on behalf of a
909 * proxy owner
910 *
911 * @lock: the rt_mutex to be locked
912 * @proxy_owner:the task to set as owner
913 *
914 * No locking. Caller has to do serializing itself
915 * Special API call for PI-futex support
916 */
917void rt_mutex_init_proxy_locked(struct rt_mutex *lock,
918 struct task_struct *proxy_owner)
919{
920 __rt_mutex_init(lock, NULL);
921 debug_rt_mutex_proxy_lock(lock, proxy_owner __RET_IP__);
922 rt_mutex_set_owner(lock, proxy_owner, 0);
923 rt_mutex_deadlock_account_lock(lock, proxy_owner);
924}
925
926/**
927 * rt_mutex_proxy_unlock - release a lock on behalf of owner
928 *
929 * @lock: the rt_mutex to be locked
930 *
931 * No locking. Caller has to do serializing itself
932 * Special API call for PI-futex support
933 */
934void rt_mutex_proxy_unlock(struct rt_mutex *lock,
935 struct task_struct *proxy_owner)
936{
937 debug_rt_mutex_proxy_unlock(lock);
938 rt_mutex_set_owner(lock, NULL, 0);
939 rt_mutex_deadlock_account_unlock(proxy_owner);
940}
941
942/**
943 * rt_mutex_next_owner - return the next owner of the lock
944 *
945 * @lock: the rt lock query
946 *
947 * Returns the next owner of the lock or NULL
948 *
949 * Caller has to serialize against other accessors to the lock
950 * itself.
951 *
952 * Special API call for PI-futex support
953 */
954struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock)
955{
956 if (!rt_mutex_has_waiters(lock))
957 return NULL;
958
959 return rt_mutex_top_waiter(lock)->task;
960}