aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorSebastien Dugue <sebastien.dugue@bull.net>2006-06-27 05:55:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 20:32:48 -0400
commit59e0e0ace7d33e8c0c125042f153f80fcc56b39e (patch)
treee73a795bd99b39a886fe3f9b46f85dbf53db5316 /kernel/futex.c
parent95e02ca9bb5324360e7dea1ea1c563036d84a5e6 (diff)
[PATCH] futex_requeue() optimization
In futex_requeue(), when the 2 futexes keys hash to the same bucket, there is no need to move the futex_q to the end of the bucket list. Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.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.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index b305b7f8dad5..6c91f938005d 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -827,17 +827,20 @@ static int futex_requeue(u32 __user *uaddr1, u32 __user *uaddr2,
827 if (++ret <= nr_wake) { 827 if (++ret <= nr_wake) {
828 wake_futex(this); 828 wake_futex(this);
829 } else { 829 } else {
830 list_move_tail(&this->list, &hb2->chain); 830 /*
831 this->lock_ptr = &hb2->lock; 831 * If key1 and key2 hash to the same bucket, no need to
832 * requeue.
833 */
834 if (likely(head1 != &hb2->chain)) {
835 list_move_tail(&this->list, &hb2->chain);
836 this->lock_ptr = &hb2->lock;
837 }
832 this->key = key2; 838 this->key = key2;
833 get_key_refs(&key2); 839 get_key_refs(&key2);
834 drop_count++; 840 drop_count++;
835 841
836 if (ret - nr_wake >= nr_requeue) 842 if (ret - nr_wake >= nr_requeue)
837 break; 843 break;
838 /* Make sure to stop if key1 == key2: */
839 if (head1 == &hb2->chain && head1 != &next->list)
840 head1 = &this->list;
841 } 844 }
842 } 845 }
843 846