For async trigger of the wait, we need to be able to pass in a futex_q that is already setup. Add that helper. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- kernel/futex/futex.h | 3 +++ kernel/futex/waitwake.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/kernel/futex/futex.h b/kernel/futex/futex.h index 8c12cef83d38..29bf78a1f475 100644 --- a/kernel/futex/futex.h +++ b/kernel/futex/futex.h @@ -156,6 +156,9 @@ extern void __futex_unqueue(struct futex_q *q); extern void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb); extern int futex_unqueue(struct futex_q *q); +extern int futex_queue_wait(struct futex_q *q, u32 __user *uaddr, + unsigned int flags, u32 val); + /** * futex_queue() - Enqueue the futex_q on the futex_hash_bucket * @q: The futex_q to enqueue diff --git a/kernel/futex/waitwake.c b/kernel/futex/waitwake.c index 5151c83e2db8..442dafdfa22a 100644 --- a/kernel/futex/waitwake.c +++ b/kernel/futex/waitwake.c @@ -706,3 +706,20 @@ static long futex_wait_restart(struct restart_block *restart) restart->futex.val, tp, restart->futex.bitset); } +int futex_queue_wait(struct futex_q *q, u32 __user *uaddr, unsigned int flags, + u32 val) +{ + struct futex_hash_bucket *hb; + int ret; + + if (!q->bitset) + return -EINVAL; + + ret = futex_wait_setup(uaddr, val, flags, q, &hb); + if (ret) + return ret; + + __futex_queue(q, hb); + spin_unlock(&hb->lock); + return 0; +} -- 2.39.2