Skip to content

Commit 1210872

Browse files
krismanaxboe
authored andcommitted
io_uring/poll: Allocate apoll with generic alloc_cache helper
This abstracts away the cache details to simplify the code. 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 b284656 commit 1210872

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

io_uring/poll.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -648,15 +648,12 @@ static struct async_poll *io_req_alloc_apoll(struct io_kiocb *req,
648648
if (req->flags & REQ_F_POLLED) {
649649
apoll = req->apoll;
650650
kfree(apoll->double_poll);
651-
} else if (!(issue_flags & IO_URING_F_UNLOCKED)) {
652-
apoll = io_alloc_cache_get(&ctx->apoll_cache);
653-
if (!apoll)
654-
goto alloc_apoll;
655-
apoll->poll.retries = APOLL_MAX_RETRY;
656651
} else {
657-
alloc_apoll:
658-
apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
659-
if (unlikely(!apoll))
652+
if (!(issue_flags & IO_URING_F_UNLOCKED))
653+
apoll = io_cache_alloc(&ctx->apoll_cache, GFP_ATOMIC, NULL);
654+
else
655+
apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
656+
if (!apoll)
660657
return NULL;
661658
apoll->poll.retries = APOLL_MAX_RETRY;
662659
}

0 commit comments

Comments
 (0)