aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-27 04:16:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:49 -0500
commit8f17d3a5049d32392b79925c73a0cf99ce6d5af0 (patch)
tree3c2aa0cbe337684d353dd2cfb0c177b4ae15217c /kernel
parent8fdd6c6df7889dc89df3d9fe0f5bbe6733e39f48 (diff)
[PATCH] lightweight robust futexes updates
- fix: initialize the robust list(s) to NULL in copy_process. - doc update - cleanup: rename _inuser to _inatomic - __user cleanups and other small cleanups Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Arjan van de Ven <arjan@infradead.org> Cc: Ulrich Drepper <drepper@redhat.com> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c5
-rw-r--r--kernel/futex.c20
-rw-r--r--kernel/futex_compat.c7
3 files changed, 16 insertions, 16 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index e0a2b449dea6..c49bd193b058 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1061,7 +1061,10 @@ static task_t *copy_process(unsigned long clone_flags,
1061 * Clear TID on mm_release()? 1061 * Clear TID on mm_release()?
1062 */ 1062 */
1063 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL; 1063 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
1064 1064 p->robust_list = NULL;
1065#ifdef CONFIG_COMPAT
1066 p->compat_robust_list = NULL;
1067#endif
1065 /* 1068 /*
1066 * sigaltstack should be cleared when sharing the same VM 1069 * sigaltstack should be cleared when sharing the same VM
1067 */ 1070 */
diff --git a/kernel/futex.c b/kernel/futex.c
index feb724b2554e..9c9b2b6b22dd 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -913,15 +913,15 @@ err_unlock:
913 * Process a futex-list entry, check whether it's owned by the 913 * Process a futex-list entry, check whether it's owned by the
914 * dying task, and do notification if so: 914 * dying task, and do notification if so:
915 */ 915 */
916int handle_futex_death(unsigned int *uaddr, struct task_struct *curr) 916int handle_futex_death(u32 __user *uaddr, struct task_struct *curr)
917{ 917{
918 unsigned int futex_val; 918 u32 uval;
919 919
920repeat: 920retry:
921 if (get_user(futex_val, uaddr)) 921 if (get_user(uval, uaddr))
922 return -1; 922 return -1;
923 923
924 if ((futex_val & FUTEX_TID_MASK) == curr->pid) { 924 if ((uval & FUTEX_TID_MASK) == curr->pid) {
925 /* 925 /*
926 * Ok, this dying thread is truly holding a futex 926 * Ok, this dying thread is truly holding a futex
927 * of interest. Set the OWNER_DIED bit atomically 927 * of interest. Set the OWNER_DIED bit atomically
@@ -932,12 +932,11 @@ repeat:
932 * thread-death.) The rest of the cleanup is done in 932 * thread-death.) The rest of the cleanup is done in
933 * userspace. 933 * userspace.
934 */ 934 */
935 if (futex_atomic_cmpxchg_inuser(uaddr, futex_val, 935 if (futex_atomic_cmpxchg_inatomic(uaddr, uval,
936 futex_val | FUTEX_OWNER_DIED) != 936 uval | FUTEX_OWNER_DIED) != uval)
937 futex_val) 937 goto retry;
938 goto repeat;
939 938
940 if (futex_val & FUTEX_WAITERS) 939 if (uval & FUTEX_WAITERS)
941 futex_wake((unsigned long)uaddr, 1); 940 futex_wake((unsigned long)uaddr, 1);
942 } 941 }
943 return 0; 942 return 0;
@@ -985,7 +984,6 @@ void exit_robust_list(struct task_struct *curr)
985 if (handle_futex_death((void *)entry + futex_offset, 984 if (handle_futex_death((void *)entry + futex_offset,
986 curr)) 985 curr))
987 return; 986 return;
988
989 /* 987 /*
990 * Fetch the next entry in the list: 988 * Fetch the next entry in the list:
991 */ 989 */
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index c153559ef289..9c077cf9aa84 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -121,9 +121,9 @@ err_unlock:
121 return ret; 121 return ret;
122} 122}
123 123
124asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val, 124asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
125 struct compat_timespec __user *utime, u32 __user *uaddr2, 125 struct compat_timespec __user *utime, u32 __user *uaddr2,
126 int val3) 126 u32 val3)
127{ 127{
128 struct timespec t; 128 struct timespec t;
129 unsigned long timeout = MAX_SCHEDULE_TIMEOUT; 129 unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
@@ -137,6 +137,5 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val,
137 if (op >= FUTEX_REQUEUE) 137 if (op >= FUTEX_REQUEUE)
138 val2 = (int) (unsigned long) utime; 138 val2 = (int) (unsigned long) utime;
139 139
140 return do_futex((unsigned long)uaddr, op, val, timeout, 140 return do_futex(uaddr, op, val, timeout, uaddr2, val2, val3);
141 (unsigned long)uaddr2, val2, val3);
142} 141}