[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DG65LJ401SCS.S5LFKDR4AEE1@kernel.org>
Date: Wed, 04 Feb 2026 12:50:37 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>
Cc: "Shivam Kalra" <shivamklr@...k.li>, <cmllamas@...gle.com>,
<gregkh@...uxfoundation.org>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lorenzo.stoakes@...cle.com>,
<vbabka@...e.cz>, <Liam.Howlett@...cle.com>, <urezki@...il.com>
Subject: Re: [PATCH v2 1/3] rust: alloc: Add shrink_to and shrink_to_fit
methods to Vec
On Wed Feb 4, 2026 at 11:32 AM CET, Alice Ryhl wrote:
> I would kind of prefer that we do this in two steps. First have
> shrink_to() use the implementation it does right now. Then a follow-up
> patch fix the TODOs in vrealloc().
This is fine with me as a short term workaround, but we should only do the full
copy under certain conditions only:
(1) is_vmalloc_addr() returns true.
(2) The new size of the allocation requires at least one page less in total.
I.e. if it is a kmalloc() buffer we don't do anything. And if it's a vmalloc()
buffer, we only shrink if we can get rid of at least one page, since otherwise
there are no savings effectively.
Shivam do you plan to follow up on the vrealloc() TODOs subsequently?
Powered by blists - more mailing lists