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

authored by

Gabriel Krisman Bertazi and committed by
Jens Axboe
b2846567 49f7a309

+1 -12
+1 -12
io_uring/futex.c
··· 251 251 io_req_task_work_add(req); 252 252 } 253 253 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 - 265 254 int io_futexv_wait(struct io_kiocb *req, unsigned int issue_flags) 266 255 { 267 256 struct io_futex *iof = io_kiocb_to_cmd(req, struct io_futex); ··· 320 331 } 321 332 322 333 io_ring_submit_lock(ctx, issue_flags); 323 - ifd = io_alloc_ifd(ctx); 334 + ifd = io_cache_alloc(&ctx->futex_cache, GFP_NOWAIT, NULL); 324 335 if (!ifd) { 325 336 ret = -ENOMEM; 326 337 goto done_unlock;