diff options
author | Darren Hart <dvhltc@us.ibm.com> | 2009-04-03 16:39:42 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-04-06 05:14:01 -0400 |
commit | 4b1c486b3587d2abf50bee4a05eb488cd4045f2c (patch) | |
tree | 17b2a04c34787cb8af37d8d73d27710a42b870de | |
parent | ca5f9524d61f54b1f618293ab92fc6b49cac864d (diff) |
futex: add helper to find the top prio waiter of a futex
Improve legibility by wrapping finding the top waiter in a function.
This will be used by the follow-on patches for enabling requeue pi.
Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/futex.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index ebb48d6d1a87..421fb5e42a10 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -276,6 +276,25 @@ void put_futex_key(int fshared, union futex_key *key) | |||
276 | drop_futex_key_refs(key); | 276 | drop_futex_key_refs(key); |
277 | } | 277 | } |
278 | 278 | ||
279 | /** | ||
280 | * futex_top_waiter() - Return the highest priority waiter on a futex | ||
281 | * @hb: the hash bucket the futex_q's reside in | ||
282 | * @key: the futex key (to distinguish it from other futex futex_q's) | ||
283 | * | ||
284 | * Must be called with the hb lock held. | ||
285 | */ | ||
286 | static struct futex_q *futex_top_waiter(struct futex_hash_bucket *hb, | ||
287 | union futex_key *key) | ||
288 | { | ||
289 | struct futex_q *this; | ||
290 | |||
291 | plist_for_each_entry(this, &hb->chain, list) { | ||
292 | if (match_futex(&this->key, key)) | ||
293 | return this; | ||
294 | } | ||
295 | return NULL; | ||
296 | } | ||
297 | |||
279 | static u32 cmpxchg_futex_value_locked(u32 __user *uaddr, u32 uval, u32 newval) | 298 | static u32 cmpxchg_futex_value_locked(u32 __user *uaddr, u32 uval, u32 newval) |
280 | { | 299 | { |
281 | u32 curval; | 300 | u32 curval; |