diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2023-04-04 13:39:57 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-04-04 09:30:39 -0600 |
commit | 69bbc6ade9d9d4e3c556cb83e77b6f3cd9ad3d18 (patch) | |
tree | 4031c5792f24423318c90df16a92e9603eb1bc71 /io_uring/alloc_cache.h | |
parent | 757ef4682b6aa29fdf752ad47f0d63eb48b261cf (diff) | |
download | lwn-69bbc6ade9d9d4e3c556cb83e77b6f3cd9ad3d18.tar.gz lwn-69bbc6ade9d9d4e3c556cb83e77b6f3cd9ad3d18.zip |
io_uring/rsrc: add custom limit for node caching
The number of entries in the rsrc node cache is limited to 512, which
still seems unnecessarily large. Add per cache thresholds and set to
to 32 for the rsrc node cache.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/d0cd538b944dac0bf878e276fc0199f21e6bccea.1680576071.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/alloc_cache.h')
-rw-r--r-- | io_uring/alloc_cache.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/io_uring/alloc_cache.h b/io_uring/alloc_cache.h index 2fbecaa3a1ba..851a527afb5e 100644 --- a/io_uring/alloc_cache.h +++ b/io_uring/alloc_cache.h @@ -13,7 +13,7 @@ struct io_cache_entry { static inline bool io_alloc_cache_put(struct io_alloc_cache *cache, struct io_cache_entry *entry) { - if (cache->nr_cached < IO_ALLOC_CACHE_MAX) { + if (cache->nr_cached < cache->max_cached) { cache->nr_cached++; wq_stack_add_head(&entry->node, &cache->list); /* KASAN poisons object */ @@ -38,10 +38,12 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c return NULL; } -static inline void io_alloc_cache_init(struct io_alloc_cache *cache, size_t size) +static inline void io_alloc_cache_init(struct io_alloc_cache *cache, + unsigned max_nr, size_t size) { cache->list.next = NULL; cache->nr_cached = 0; + cache->max_cached = max_nr; cache->elem_size = size; } |