Skip to content

Commit fd30d1c

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix poll/netmsg alloc caches
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: [email protected] Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 4ff0b50 commit fd30d1c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

io_uring/alloc_cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c
2727
struct hlist_node *node = cache->list.first;
2828

2929
hlist_del(node);
30+
cache->nr_cached--;
3031
return container_of(node, struct io_cache_entry, node);
3132
}
3233

0 commit comments

Comments
 (0)