Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <krisman@suse.de>
Link: https://lore.kernel.org/r/20241216204615.759089-5-krisman@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Gabriel Krisman Bertazi and committed by
Jens Axboe
12108729 b2846567

+5 -8
+5 -8
io_uring/poll.c
··· 648 648 if (req->flags & REQ_F_POLLED) { 649 649 apoll = req->apoll; 650 650 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; 656 651 } 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) 660 657 return NULL; 661 658 apoll->poll.retries = APOLL_MAX_RETRY; 662 659 }