[PATCH 1/1] io_uring: fix poll/netmsg alloc caches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: 9b797a37c4bd8 ("io_uring: add abstraction around apoll cache")
Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
 io_uring/alloc_cache.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/io_uring/alloc_cache.h b/io_uring/alloc_cache.h
index 3aba7b356320..2fbecaa3a1ba 100644
--- a/io_uring/alloc_cache.h
+++ b/io_uring/alloc_cache.h
@@ -31,6 +31,7 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c
 		entry = container_of(cache->list.next, struct io_cache_entry, node);
 		kasan_unpoison_range(entry, cache->elem_size);
 		cache->list.next = cache->list.next->next;
+		cache->nr_cached--;
 		return entry;
 	}
 
-- 
2.39.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux