Skip to content

Commit e9a56c9

Browse files
committed
futex: make the vectored futex operations available
Rename unqueue_multiple() as futex_unqueue_multiple(), and make both that and futex_wait_multiple_setup() available for external users. This is in preparation for wiring up vectored waits in io_uring. Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 5177c0c commit e9a56c9

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

kernel/futex/futex.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ extern int futex_parse_waitv(struct futex_vector *futexv,
366366
unsigned int nr_futexes, futex_wake_fn *wake,
367367
void *wake_data);
368368

369+
extern int futex_wait_multiple_setup(struct futex_vector *vs, int count,
370+
int *woken);
371+
372+
extern int futex_unqueue_multiple(struct futex_vector *v, int count);
373+
369374
extern int futex_wait_multiple(struct futex_vector *vs, unsigned int count,
370375
struct hrtimer_sleeper *to);
371376

kernel/futex/waitwake.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ void futex_wait_queue(struct futex_hash_bucket *hb, struct futex_q *q,
372372
}
373373

374374
/**
375-
* unqueue_multiple - Remove various futexes from their hash bucket
375+
* futex_unqueue_multiple - Remove various futexes from their hash bucket
376376
* @v: The list of futexes to unqueue
377377
* @count: Number of futexes in the list
378378
*
@@ -382,7 +382,7 @@ void futex_wait_queue(struct futex_hash_bucket *hb, struct futex_q *q,
382382
* - >=0 - Index of the last futex that was awoken;
383383
* - -1 - No futex was awoken
384384
*/
385-
static int unqueue_multiple(struct futex_vector *v, int count)
385+
int futex_unqueue_multiple(struct futex_vector *v, int count)
386386
{
387387
int ret = -1, i;
388388

@@ -410,7 +410,7 @@ static int unqueue_multiple(struct futex_vector *v, int count)
410410
* - 0 - Success
411411
* - <0 - -EFAULT, -EWOULDBLOCK or -EINVAL
412412
*/
413-
static int futex_wait_multiple_setup(struct futex_vector *vs, int count, int *woken)
413+
int futex_wait_multiple_setup(struct futex_vector *vs, int count, int *woken)
414414
{
415415
struct futex_hash_bucket *hb;
416416
bool retry = false;
@@ -472,7 +472,7 @@ static int futex_wait_multiple_setup(struct futex_vector *vs, int count, int *wo
472472
* was woken, we don't return error and return this index to
473473
* userspace
474474
*/
475-
*woken = unqueue_multiple(vs, i);
475+
*woken = futex_unqueue_multiple(vs, i);
476476
if (*woken >= 0)
477477
return 1;
478478

@@ -557,7 +557,7 @@ int futex_wait_multiple(struct futex_vector *vs, unsigned int count,
557557

558558
__set_current_state(TASK_RUNNING);
559559

560-
ret = unqueue_multiple(vs, count);
560+
ret = futex_unqueue_multiple(vs, count);
561561
if (ret >= 0)
562562
return ret;
563563

0 commit comments

Comments
 (0)