summaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-27 01:16:27 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 08:44:49 -0800
commit8f17d3a5049d32392b79925c73a0cf99ce6d5af0 (patch)
tree3c2aa0cbe337684d353dd2cfb0c177b4ae15217c /kernel/futex.c
parent8fdd6c6df7889dc89df3d9fe0f5bbe6733e39f48 (diff)
downloadlinux-stable-8f17d3a5049d32392b79925c73a0cf99ce6d5af0.tar.gz
linux-stable-8f17d3a5049d32392b79925c73a0cf99ce6d5af0.tar.bz2
linux-stable-8f17d3a5049d32392b79925c73a0cf99ce6d5af0.zip
[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/futex.c')
-rw-r--r--kernel/futex.c20
1 files changed, 9 insertions, 11 deletions
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:
* Process a futex-list entry, check whether it's owned by the
* dying task, and do notification if so:
*/
-int handle_futex_death(unsigned int *uaddr, struct task_struct *curr)
+int handle_futex_death(u32 __user *uaddr, struct task_struct *curr)
{
- unsigned int futex_val;
+ u32 uval;
-repeat:
- if (get_user(futex_val, uaddr))
+retry:
+ if (get_user(uval, uaddr))
return -1;
- if ((futex_val & FUTEX_TID_MASK) == curr->pid) {
+ if ((uval & FUTEX_TID_MASK) == curr->pid) {
/*
* Ok, this dying thread is truly holding a futex
* of interest. Set the OWNER_DIED bit atomically
@@ -932,12 +932,11 @@ repeat:
* thread-death.) The rest of the cleanup is done in
* userspace.
*/
- if (futex_atomic_cmpxchg_inuser(uaddr, futex_val,
- futex_val | FUTEX_OWNER_DIED) !=
- futex_val)
- goto repeat;
+ if (futex_atomic_cmpxchg_inatomic(uaddr, uval,
+ uval | FUTEX_OWNER_DIED) != uval)
+ goto retry;
- if (futex_val & FUTEX_WAITERS)
+ if (uval & FUTEX_WAITERS)
futex_wake((unsigned long)uaddr, 1);
}
return 0;
@@ -985,7 +984,6 @@ void exit_robust_list(struct task_struct *curr)
if (handle_futex_death((void *)entry + futex_offset,
curr))
return;
-
/*
* Fetch the next entry in the list:
*/