summaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index b305b7f..6c91f93 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -827,17 +827,20 @@ static int futex_requeue(u32 __user *uaddr1, u32 __user *uaddr2,
if (++ret <= nr_wake) {
wake_futex(this);
} else {
- list_move_tail(&this->list, &hb2->chain);
- this->lock_ptr = &hb2->lock;
+ /*
+ * If key1 and key2 hash to the same bucket, no need to
+ * requeue.
+ */
+ if (likely(head1 != &hb2->chain)) {
+ list_move_tail(&this->list, &hb2->chain);
+ this->lock_ptr = &hb2->lock;
+ }
this->key = key2;
get_key_refs(&key2);
drop_count++;
if (ret - nr_wake >= nr_requeue)
break;
- /* Make sure to stop if key1 == key2: */
- if (head1 == &hb2->chain && head1 != &next->list)
- head1 = &this->list;
}
}
OpenPOWER on IntegriCloud