From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 1/1] io_uring: fix poll/netmsg alloc caches
Date: Thu, 30 Mar 2023 11:31:36 +0100 [thread overview]
Message-ID: <0126812afc5845096c987c1003e2ec078eefcd8a.1680172256.git.asml.silence@gmail.com> (raw)
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
next reply other threads:[~2023-03-30 10:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 10:31 Pavel Begunkov [this message]
2023-03-30 12:54 ` [PATCH 1/1] io_uring: fix poll/netmsg alloc caches Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0126812afc5845096c987c1003e2ec078eefcd8a.1680172256.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox