Commit 12108729 authored by Gabriel Krisman Bertazi's avatar Gabriel Krisman Bertazi Committed by Jens Axboe
Browse files

io_uring/poll: Allocate apoll with generic alloc_cache helper



This abstracts away the cache details to simplify the code.

Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@suse.de>
Link: https://lore.kernel.org/r/20241216204615.759089-5-krisman@suse.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b2846567
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -648,15 +648,12 @@ static struct async_poll *io_req_alloc_apoll(struct io_kiocb *req,
	if (req->flags & REQ_F_POLLED) {
		apoll = req->apoll;
		kfree(apoll->double_poll);
	} else if (!(issue_flags & IO_URING_F_UNLOCKED)) {
		apoll = io_alloc_cache_get(&ctx->apoll_cache);
		if (!apoll)
			goto alloc_apoll;
		apoll->poll.retries = APOLL_MAX_RETRY;
	} else {
alloc_apoll:
		if (!(issue_flags & IO_URING_F_UNLOCKED))
			apoll = io_cache_alloc(&ctx->apoll_cache, GFP_ATOMIC, NULL);
		else
			apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
		if (unlikely(!apoll))
		if (!apoll)
			return NULL;
		apoll->poll.retries = APOLL_MAX_RETRY;
	}