Skip to content

Commit

Permalink
io_uring: fix poll/netmsg alloc caches
Browse files Browse the repository at this point in the history
We increase cache->nr_cached when we free into the cache but don't
decrease when we take from it, so in some time we'll get an empty
cache with cache->nr_cached larger than IO_ALLOC_CACHE_MAX, that fails
io_alloc_cache_put() and effectively disables caching.

Fixes: 9b797a3 ("io_uring: add abstraction around apoll cache")
Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Mar 30, 2023
1 parent 4ff0b50 commit fd30d1c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions io_uring/alloc_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c
struct hlist_node *node = cache->list.first;

hlist_del(node);
cache->nr_cached--;
return container_of(node, struct io_cache_entry, node);
}

Expand Down

0 comments on commit fd30d1c

Please sign in to comment.