Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145862
b: refs/heads/master
c: 9121e47
h: refs/heads/master
v: v3
  • Loading branch information
Darren Hart authored and Thomas Gleixner committed Apr 6, 2009
1 parent e9aea99 commit 4a1ef95
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a72188d8a64ebe74722f1cf7ffac41b41ffdba21
refs/heads/master: 9121e4783cd5c7e2a407763f3b61c2d573891133
43 changes: 29 additions & 14 deletions trunk/kernel/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,34 @@ futex_wake_op(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
return ret;
}

/**
* requeue_futex() - Requeue a futex_q from one hb to another
* @q: the futex_q to requeue
* @hb1: the source hash_bucket
* @hb2: the target hash_bucket
* @key2: the new key for the requeued futex_q
*/
static inline
void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
struct futex_hash_bucket *hb2, union futex_key *key2)
{

/*
* If key1 and key2 hash to the same bucket, no need to
* requeue.
*/
if (likely(&hb1->chain != &hb2->chain)) {
plist_del(&q->list, &hb1->chain);
plist_add(&q->list, &hb2->chain);
q->lock_ptr = &hb2->lock;
#ifdef CONFIG_DEBUG_PI_LIST
q->list.plist.lock = &hb2->lock;
#endif
}
get_futex_key_refs(key2);
q->key = *key2;
}

/*
* Requeue all waiters hashed on one physical page to another
* physical page.
Expand Down Expand Up @@ -999,20 +1027,7 @@ static int futex_requeue(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
if (++ret <= nr_wake) {
wake_futex(this);
} else {
/*
* If key1 and key2 hash to the same bucket, no need to
* requeue.
*/
if (likely(head1 != &hb2->chain)) {
plist_del(&this->list, &hb1->chain);
plist_add(&this->list, &hb2->chain);
this->lock_ptr = &hb2->lock;
#ifdef CONFIG_DEBUG_PI_LIST
this->list.plist.lock = &hb2->lock;
#endif
}
this->key = key2;
get_futex_key_refs(&key2);
requeue_futex(this, hb1, hb2, &key2);
drop_count++;

if (ret - nr_wake >= nr_requeue)
Expand Down

0 comments on commit 4a1ef95

Please sign in to comment.