Last active
January 22, 2020 06:09
-
-
Save franz1981/319b80fe02d50ed91ee1d199d755833e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Wake up waiters matching bitset queued on this futex (uaddr). | |
*/ | |
static int futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) | |
{ | |
struct futex_hash_bucket *hb; | |
struct futex_q *this, *next; | |
union futex_key key = FUTEX_KEY_INIT; | |
int ret; | |
DEFINE_WAKE_Q(wake_q); | |
if (!bitset) | |
return -EINVAL; | |
ret = get_futex_key(uaddr, flags & FLAGS_SHARED, &key, FUTEX_READ); | |
if (unlikely(ret != 0)) | |
goto out; | |
hb = hash_futex(&key); | |
/* Make sure we really have tasks to wakeup */ | |
if (!hb_waiters_pending(hb)) | |
goto out_put_key; | |
spin_lock(&hb->lock); | |
// plist_for_each_entry_safe: mark_wake_futex the matching futex | |
// ... | |
spin_unlock(&hb->lock); | |
wake_up_q(&wake_q); | |
out_put_key: | |
put_futex_key(&key); | |
out: | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment