futex: factor out the futex wake handling
authorJens Axboe <axboe@kernel.dk>
Thu, 8 Jun 2023 17:56:06 +0000 (11:56 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Sep 2023 15:41:32 +0000 (09:41 -0600)
commit397ba0ae6d43b02c8bf7007628e518eeb2adce77
treec671f0a5a2d94e1f932b76f4c70260e4d8d8c5c4
parent5858c9b1c12b242b9bbcae26edcfd3706471b1e4
futex: factor out the futex wake handling

In preparation for having another waker that isn't futex_wake_mark(),
add a wake handler in futex_q. No extra data is associated with the
handler outside of struct futex_q itself. futex_wake_mark() is defined as
the standard wakeup helper, now set through futex_q_init like other
defaults.

Normal sync futex waiting relies on wake_q holding tasks that should
be woken up. This is what futex_wake_mark() does, it'll unqueue the
futex and add the associated task to the wake queue. For async usage of
futex waiting, rather than having tasks sleeping on the futex, we'll
need to deal with a futex wake differently. For the planned io_uring
case, that means posting a completion event for the task in question.
Having a definable wake handler can help support that use case.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
kernel/futex/futex.h
kernel/futex/requeue.c
kernel/futex/waitwake.c