[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <91744c4e-d014-4fc8-856b-fafbd4ede284@zohomail.in>
Date: Wed, 11 Feb 2026 15:05:52 +0530
From: Shivam Kalra <shivamkalra98@...omail.in>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Alice Ryhl <aliceryhl@...gle.com>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 0/4] rust: alloc: add Vec shrinking methods
On 11/02/26 14:27, Danilo Krummrich wrote:
> On Wed Feb 11, 2026 at 9:41 AM CET, Shivam Kalra wrote:
>> Thanks Alice. I'll go with the standalone helper function approach
>> with separate impl blocks for Vec<T, Vmalloc> and Vec<T, KVmalloc>.
>
> If it's only needed for KVmalloc, which apparently is the case, let's just add
> it for KVVec only.
>
> Also, please make sure to add a TODO comment mentioning why this workaround
> exists and what it should be replaced with, i.e. a generic shrink_to() that
> calls into A::realloc().
Thanks for the discussion on v3. The direction for v4 is now clear.
Summary of changes for v4:
1. Drop the Shrinkable trait entirely. (Danilo)
2. Implement shrink_to() only for KVVec (impl<T> Vec<T, KVmalloc>),
since that covers the actual use case (binder). No new traits
needed. (Danilo,Alice)
3. Add a TODO comment explaining this is a temporary workaround
(page-boundary check + manual alloc+copy+free) that should be
replaced with a generic Vec<T, A>::shrink_to() calling
A::realloc() once vrealloc gains in-place shrinking. (Danilo)
4. In the binder patch, use a less aggressive shrink strategy to
avoid shrink-then-regrow oscillation: (Alice)
if len < cap / 4 {
shrink_to(cap / 2);
}
5. Fix commit prefix to rust_binder: instead of rust: binder:. (Alice)
Also noting that starting from v4, I will be sending patches from
a new email address: shivamkalra98@...omail.in
I previously sent patches as shivamklr@...k.li, then briefly from
shivamkalra98@...il.com. Both accounts ran out of quota, so all
future patches (v4+) will come from this address.
Thanks,
Shivam
Powered by blists - more mailing lists