diff options
| author | Jens Axboe <axboe@kernel.dk> | 2025-01-22 20:00:57 -0700 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-01-23 11:32:28 -0700 |
| commit | fa3595523d72d13508befd28cf2ca642cafc69f7 (patch) | |
| tree | a42f543b9d0835a1f64e662dbba87959b24a4b0e /io_uring/io_uring.h | |
| parent | eaf72f7b414f5944585e7dee9c915c7f8f7f6344 (diff) | |
| download | linux-fa3595523d72d13508befd28cf2ca642cafc69f7.tar.gz linux-fa3595523d72d13508befd28cf2ca642cafc69f7.tar.bz2 linux-fa3595523d72d13508befd28cf2ca642cafc69f7.zip | |
io_uring: get rid of alloc cache init_once handling
init_once is called when an object doesn't come from the cache, and
hence needs initial clearing of certain members. While the whole
struct could get cleared by memset() in that case, a few of the cache
members are large enough that this may cause unnecessary overhead if
the caches used aren't large enough to satisfy the workload. For those
cases, some churn of kmalloc+kfree is to be expected.
Ensure that the 3 users that need clearing put the members they need
cleared at the start of the struct, and wrap the rest of the struct in
a struct group so the offset is known.
While at it, improve the interaction with KASAN such that when/if
KASAN writes to members inside the struct that should be retained over
caching, it won't trip over itself. For rw and net, the retaining of
the iovec over caching is disabled if KASAN is enabled. A helper will
free and clear those members in that case.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.h')
| -rw-r--r-- | io_uring/io_uring.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index f65e3f3ede51..67adbb3c1bf5 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -226,10 +226,9 @@ static inline void io_req_set_res(struct io_kiocb *req, s32 res, u32 cflags) } static inline void *io_uring_alloc_async_data(struct io_alloc_cache *cache, - struct io_kiocb *req, - void (*init_once)(void *obj)) + struct io_kiocb *req) { - req->async_data = io_cache_alloc(cache, GFP_KERNEL, init_once); + req->async_data = io_cache_alloc(cache, GFP_KERNEL); if (req->async_data) req->flags |= REQ_F_ASYNC_DATA; return req->async_data; |
