On 11/18/24 6:22 PM, Gabriel Krisman Bertazi wrote: > diff --git a/io_uring/alloc_cache.h b/io_uring/alloc_cache.h > index b7a38a2069cf..6b34e491a30a 100644 > --- a/io_uring/alloc_cache.h > +++ b/io_uring/alloc_cache.h > @@ -30,6 +30,13 @@ static inline void *io_alloc_cache_get(struct io_alloc_cache *cache) > return NULL; > } > > +static inline void *io_alloc_cache_alloc(struct io_alloc_cache *cache, gfp_t gfp) > +{ > + if (!cache->nr_cached) > + return kzalloc(cache->elem_size, gfp); > + return io_alloc_cache_get(cache); > +} I don't think you want to use kzalloc here. The caller will need to clear what its needs for the cached path anyway, so has no other option than to clear/set things twice for that case. -- Jens Axboe