Re: [PATCH v3 0/4] rust: alloc: add Vec shrinking methods

From: Shivam Kalra

Date: Tue Feb 10 2026 - 08:41:34 EST


This is a follow-up to my v3 series:
https://lore.kernel.org/rust-for-linux/20260207-binder-shrink-vec-v3-v3-0-8ff388563427@xxxxxxx/

Hi all,

Thanks for the feedback on v3. Before I respin, I want to confirm
the direction for v4 to avoid unnecessary iterations.

Proposed changes for v4:

1. Drop the Shrinkable trait entirely. Make shrink_to() a normal
method on Vec<T, A> that calls A::realloc(). (Danilo)

2. Add a temporary ShrinkQuirk trait to handle the vmalloc workaround
(page-boundary check + manual alloc+copy+free) until vrealloc
gains in-place shrinking support. (Danilo)

3. 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);
}

4. 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@xxxxxxxxx

Does this look right? Any other concerns before I send v4?

Thanks,
Shivam

Note: I previously sent patches as shivamklr@xxxxxxx. That account
has run out of quota, so I'm continuing from shivamkalra98@xxxxxxxxx
going forward. All future patches (v4+) will come from this address.