* [PATCH 1/1] io_uring: fix poll/netmsg alloc caches
@ 2023-03-30 10:31 Pavel Begunkov
2023-03-30 12:54 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2023-03-30 10:31 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe, asml.silence
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 <[email protected]>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-30 12:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-30 10:31 [PATCH 1/1] io_uring: fix poll/netmsg alloc caches Pavel Begunkov
2023-03-30 12:54 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox