diff options
| author | Pavel Begunkov <asml.silence@gmail.com> | 2026-03-23 15:44:03 +0300 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-04-01 19:21:13 +0300 |
| commit | 5c727ce042988df45232cfdb6599bb46116fd69c (patch) | |
| tree | 1f907bbcc1ebe5caa1630109cbc7e33a9e542de6 | |
| parent | f0b92207a00c731cfbfdefdcf9f9350a11e30ab3 (diff) | |
| download | linux-5c727ce042988df45232cfdb6599bb46116fd69c.tar.xz | |
io_uring/zcrx: cache fallback availability in zcrx ctx
Store a flag in struct io_zcrx_ifq telling if the backing memory is
normal page or dmabuf based. It was looking it up from the area, however
it logically allocates from the zcrx ctx and not a particular area, and
once we add more than one area it'll become a mess.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://patch.msgid.link/65e75408a7758fe7e60fae89b7a8d5ae4857f515.1774261953.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | io_uring/zcrx.c | 9 | ||||
| -rw-r--r-- | io_uring/zcrx.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c index e637052b645a..32829775fb6b 100644 --- a/io_uring/zcrx.c +++ b/io_uring/zcrx.c @@ -423,8 +423,13 @@ static void io_zcrx_free_area(struct io_zcrx_ifq *ifq, static int io_zcrx_append_area(struct io_zcrx_ifq *ifq, struct io_zcrx_area *area) { + bool kern_readable = !area->mem.is_dmabuf; + if (WARN_ON_ONCE(ifq->area)) return -EINVAL; + if (WARN_ON_ONCE(ifq->kern_readable != kern_readable)) + return -EINVAL; + ifq->area = area; return 0; } @@ -882,6 +887,8 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx, if (ret) goto err; + ifq->kern_readable = !(area.flags & IORING_ZCRX_AREA_DMABUF); + if (!(reg.flags & ZCRX_REG_NODEV)) { ret = zcrx_register_netdev(ifq, ®, &area); if (ret) @@ -1298,7 +1305,7 @@ static struct net_iov *io_alloc_fallback_niov(struct io_zcrx_ifq *ifq) struct io_zcrx_area *area = ifq->area; struct net_iov *niov = NULL; - if (area->mem.is_dmabuf) + if (!ifq->kern_readable) return NULL; scoped_guard(spinlock_bh, &area->freelist_lock) diff --git a/io_uring/zcrx.h b/io_uring/zcrx.h index 893cd3708a06..3e07238a4eb0 100644 --- a/io_uring/zcrx.h +++ b/io_uring/zcrx.h @@ -54,6 +54,7 @@ struct io_zcrx_ifq { unsigned niov_shift; struct user_struct *user; struct mm_struct *mm_account; + bool kern_readable; struct zcrx_rq rq ____cacheline_aligned_in_smp; |
