Re: [PATCH rust-next] rust: binder: refactor context management to use KVVec

From: Alice Ryhl

Date: Sun Jan 18 2026 - 04:36:24 EST


On Sat, Jan 17, 2026 at 09:22:42AM -0700, jkhall81 wrote:
> Replace the intrusive linked list management in context.rs with KVVec.
> This modernization simplifies the ownership model by using standard
> Arc-based tracking and moves away from manual unsafe list removals.
>
> The refactor improves memory safety by leveraging Rust's contiguous
> collection types while maintaining proper error propagation for
> allocation failures during process registration.
>
> Suggested-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Link: https://github.com/rust-for-linux/linux/issues/1215
> Signed-off-by: jkhall81 <jason.kei.hall@xxxxxxxxx>

The subject says [PATCH rust-next], but this would land through
char-misc, not rust-next, as that's where Binder belongs.

You can leave out the branch name and just say [PATCH].

Also, I usually use 'rust_binder:' instead of 'rust: binder:' for the
commit message.

> pub(crate) fn get_all_contexts() -> Result<KVec<Arc<Context>>> {
> pub(crate) fn get_all_procs(&self) -> Result<KVec<Arc<Process>>> {

These two methods need to use KVVec instead of KVec.

Also, I think some of these loops could be replaced with simply
Vec::clone().

Alice