Skip to content

Commit b284656

Browse files
krismanaxboe
authored andcommitted
io_uring/futex: Allocate ifd with generic alloc_cache helper
Instead of open-coding the allocation, use the generic alloc_cache helper. Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 49f7a30 commit b284656

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

io_uring/futex.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,6 @@ static void io_futex_wake_fn(struct wake_q_head *wake_q, struct futex_q *q)
251251
io_req_task_work_add(req);
252252
}
253253

254-
static struct io_futex_data *io_alloc_ifd(struct io_ring_ctx *ctx)
255-
{
256-
struct io_futex_data *ifd;
257-
258-
ifd = io_alloc_cache_get(&ctx->futex_cache);
259-
if (ifd)
260-
return ifd;
261-
262-
return kmalloc(sizeof(struct io_futex_data), GFP_NOWAIT);
263-
}
264-
265254
int io_futexv_wait(struct io_kiocb *req, unsigned int issue_flags)
266255
{
267256
struct io_futex *iof = io_kiocb_to_cmd(req, struct io_futex);
@@ -331,7 +320,7 @@ int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags)
331320
}
332321

333322
io_ring_submit_lock(ctx, issue_flags);
334-
ifd = io_alloc_ifd(ctx);
323+
ifd = io_cache_alloc(&ctx->futex_cache, GFP_NOWAIT, NULL);
335324
if (!ifd) {
336325
ret = -ENOMEM;
337326
goto done_unlock;

0 commit comments

Comments
 (0)