[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dfc04388-9d43-49ac-8497-3488916629e0@cock.li>
Date: Thu, 5 Feb 2026 03:25:29 +0530
From: Shivam Kalra <shivamklr@...k.li>
To: Danilo Krummrich <dakr@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>
Cc: 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 04/02/26 17:20, Danilo Krummrich wrote:
> 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?
I'll work on v3 that addresses your conditions
(only shrink for vmalloc buffers when freeing >= 1 page).
I'll check if the necessary primitives (like is_vmalloc_addr) are
exposed to Rust - if not, I may need to add helper functions or bindings.
As for the vrealloc() TODOs - yes, I'm happy to follow up on that as a
separate series. Since it would be my first time touching the mm
subsystem C code, I'd appreciate any pointers on the preferred approach
when I get there.
Powered by blists - more mailing lists