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: pass in struct io_big_cqe to io_alloc_ocqe()

Rather than pass extra1/extra2 separately, just pass in the (now) named
io_big_cqe struct instead. The callers that don't use/support CQE32 will
now just pass a single NULL, rather than two seperate mystery zero
values.

Move the clearing of the big_cqe elements into io_alloc_ocqe() as well,
so it can get moved out of the generic code.

Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

+12 -13
+1 -1
include/linux/io_uring_types.h
··· 710 710 const struct cred *creds; 711 711 struct io_wq_work work; 712 712 713 - struct { 713 + struct io_big_cqe { 714 714 u64 extra1; 715 715 u64 extra2; 716 716 } big_cqe;
+11 -12
io_uring/io_uring.c
··· 724 724 } 725 725 726 726 static struct io_overflow_cqe *io_alloc_ocqe(struct io_ring_ctx *ctx, 727 - struct io_cqe *cqe, u64 extra1, 728 - u64 extra2, gfp_t gfp) 727 + struct io_cqe *cqe, 728 + struct io_big_cqe *big_cqe, gfp_t gfp) 729 729 { 730 730 struct io_overflow_cqe *ocqe; 731 731 size_t ocq_size = sizeof(struct io_overflow_cqe); ··· 734 734 if (is_cqe32) 735 735 ocq_size += sizeof(struct io_uring_cqe); 736 736 737 - ocqe = kmalloc(ocq_size, gfp | __GFP_ACCOUNT); 737 + ocqe = kzalloc(ocq_size, gfp | __GFP_ACCOUNT); 738 738 trace_io_uring_cqe_overflow(ctx, cqe->user_data, cqe->res, cqe->flags, ocqe); 739 739 if (ocqe) { 740 740 ocqe->cqe.user_data = cqe->user_data; 741 741 ocqe->cqe.res = cqe->res; 742 742 ocqe->cqe.flags = cqe->flags; 743 - if (is_cqe32) { 744 - ocqe->cqe.big_cqe[0] = extra1; 745 - ocqe->cqe.big_cqe[1] = extra2; 743 + if (is_cqe32 && big_cqe) { 744 + ocqe->cqe.big_cqe[0] = big_cqe->extra1; 745 + ocqe->cqe.big_cqe[1] = big_cqe->extra2; 746 746 } 747 747 } 748 + if (big_cqe) 749 + big_cqe->extra1 = big_cqe->extra2 = 0; 748 750 return ocqe; 749 751 } 750 752 ··· 823 821 struct io_overflow_cqe *ocqe; 824 822 struct io_cqe cqe = io_init_cqe(user_data, res, cflags); 825 823 826 - ocqe = io_alloc_ocqe(ctx, &cqe, 0, 0, GFP_ATOMIC); 824 + ocqe = io_alloc_ocqe(ctx, &cqe, NULL, GFP_ATOMIC); 827 825 filled = io_cqring_add_overflow(ctx, ocqe); 828 826 } 829 827 io_cq_unlock_post(ctx); ··· 843 841 struct io_overflow_cqe *ocqe; 844 842 struct io_cqe cqe = io_init_cqe(user_data, res, cflags); 845 843 846 - ocqe = io_alloc_ocqe(ctx, &cqe, 0, 0, GFP_KERNEL); 844 + ocqe = io_alloc_ocqe(ctx, &cqe, NULL, GFP_KERNEL); 847 845 spin_lock(&ctx->completion_lock); 848 846 io_cqring_add_overflow(ctx, ocqe); 849 847 spin_unlock(&ctx->completion_lock); ··· 1453 1451 gfp_t gfp = ctx->lockless_cq ? GFP_KERNEL : GFP_ATOMIC; 1454 1452 struct io_overflow_cqe *ocqe; 1455 1453 1456 - ocqe = io_alloc_ocqe(ctx, &req->cqe, req->big_cqe.extra1, 1457 - req->big_cqe.extra2, gfp); 1454 + ocqe = io_alloc_ocqe(ctx, &req->cqe, &req->big_cqe, gfp); 1458 1455 if (ctx->lockless_cq) { 1459 1456 spin_lock(&ctx->completion_lock); 1460 1457 io_cqring_add_overflow(ctx, ocqe); ··· 1461 1460 } else { 1462 1461 io_cqring_add_overflow(ctx, ocqe); 1463 1462 } 1464 - 1465 - memset(&req->big_cqe, 0, sizeof(req->big_cqe)); 1466 1463 } 1467 1464 } 1468 1465 __io_cq_unlock_post(ctx);