diff options
author | Darren Hart <dvhltc@us.ibm.com> | 2009-07-31 19:20:10 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-04 09:59:14 -0400 |
commit | cc6db4e60116c1f76577b6850a35ae7de69a95b6 (patch) | |
tree | 52c2a020429f4664453719483ac3d3d993802330 /kernel | |
parent | a33a052f19a21d727847391c8c1aff3fb221c472 (diff) |
futex: Correct futex_wait_requeue_pi() commentary
The state machine described in the comments wasn't updated with
a follow-on fix. Address that and cleanup the corresponding
commentary in the function.
Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <4A737C2A.9090001@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/futex.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index 0672ff88f159..d077201b393d 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -2102,11 +2102,11 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, | |||
2102 | * We call schedule in futex_wait_queue_me() when we enqueue and return there | 2102 | * We call schedule in futex_wait_queue_me() when we enqueue and return there |
2103 | * via the following: | 2103 | * via the following: |
2104 | * 1) wakeup on uaddr2 after an atomic lock acquisition by futex_requeue() | 2104 | * 1) wakeup on uaddr2 after an atomic lock acquisition by futex_requeue() |
2105 | * 2) wakeup on uaddr2 after a requeue and subsequent unlock | 2105 | * 2) wakeup on uaddr2 after a requeue |
2106 | * 3) signal (before or after requeue) | 2106 | * 3) signal |
2107 | * 4) timeout (before or after requeue) | 2107 | * 4) timeout |
2108 | * | 2108 | * |
2109 | * If 3, we setup a restart_block with futex_wait_requeue_pi() as the function. | 2109 | * If 3, cleanup and return -ERESTARTNOINTR. |
2110 | * | 2110 | * |
2111 | * If 2, we may then block on trying to take the rt_mutex and return via: | 2111 | * If 2, we may then block on trying to take the rt_mutex and return via: |
2112 | * 5) successful lock | 2112 | * 5) successful lock |
@@ -2114,7 +2114,7 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, | |||
2114 | * 7) timeout | 2114 | * 7) timeout |
2115 | * 8) other lock acquisition failure | 2115 | * 8) other lock acquisition failure |
2116 | * | 2116 | * |
2117 | * If 6, we setup a restart_block with futex_lock_pi() as the function. | 2117 | * If 6, return -EWOULDBLOCK (restarting the syscall would do the same). |
2118 | * | 2118 | * |
2119 | * If 4 or 7, we cleanup and return with -ETIMEDOUT. | 2119 | * If 4 or 7, we cleanup and return with -ETIMEDOUT. |
2120 | * | 2120 | * |
@@ -2232,14 +2232,11 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, | |||
2232 | rt_mutex_unlock(pi_mutex); | 2232 | rt_mutex_unlock(pi_mutex); |
2233 | } else if (ret == -EINTR) { | 2233 | } else if (ret == -EINTR) { |
2234 | /* | 2234 | /* |
2235 | * We've already been requeued, but we have no way to | 2235 | * We've already been requeued, but cannot restart by calling |
2236 | * restart by calling futex_lock_pi() directly. We | 2236 | * futex_lock_pi() directly. We could restart this syscall, but |
2237 | * could restart the syscall, but that will look at | 2237 | * it would detect that the user space "val" changed and return |
2238 | * the user space value and return right away. So we | 2238 | * -EWOULDBLOCK. Save the overhead of the restart and return |
2239 | * drop back with EWOULDBLOCK to tell user space that | 2239 | * -EWOULDBLOCK directly. |
2240 | * "val" has been changed. That's the same what the | ||
2241 | * restart of the syscall would do in | ||
2242 | * futex_wait_setup(). | ||
2243 | */ | 2240 | */ |
2244 | ret = -EWOULDBLOCK; | 2241 | ret = -EWOULDBLOCK; |
2245 | } | 2242 | } |