Re: [PATCH] mempool: optimize mempool resizing

From: Christoph Hellwig

Date: Wed Oct 14 2026 - 09:10:31 EST


On Wed, Oct 14, 2026 at 10:45:28AM +0200, Vitaly Wool wrote:
> We are using mempool to store a large set of preallocated rather big buffers. In case
> of memory pressure we'd call mempool_resize() (via shrinker callbacks) to reduce the
> amount of memory occupied by that set, and when the situation stabilizes, we'd go back
> to the original set again.
>
> Imagine you have a mempool with 10000 elements, and you have to reduce it to 3000. Then
> if you at some point want to go back to 10000, you'll end up reallocating the elements

Who is "we" and where is the code? This is a highly unusual, not to
say most like broken usage of mempools. If you need changes to support
such a use case you should include a link to the intree user (or bundle
it with the submission of the new code).