Re: [RFC][PATCH RT 1/2] futex_requeue-optimize

From: Andrew Morton
Date: Thu May 11 2006 - 12:18:43 EST


Sébastien Dugué <sebastien.dugue@xxxxxxxx> wrote:
>
>
>
> 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.
>
> ...
>
> Index: linux-2.6.16-rt20/kernel/futex.c
> ===================================================================
> --- linux-2.6.16-rt20.orig/kernel/futex.c 2006-05-04 10:58:38.000000000 +0200
> +++ linux-2.6.16-rt20/kernel/futex.c 2006-05-04 10:58:55.000000000 +0200
> @@ -835,17 +835,20 @@ static int futex_requeue(u32 __user *uad
> 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;
> }
> }

For some reason I get a reject when applying this. Which is odd, because I
see no differences in there. Oh well - please try to work out what went
wrong and double-check that the patch which I applied still makes sense.

Should the futex code be using hlist_heads for that hashtable?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/