Re: [PATCH] rust_binder: Reuse the free-index node in the range allocator
From: Peder Bergan
Date: Sun Nov 29 2026 - 13:50:39 EST
Hi Alice,
Thanks for reviewing the patch and for the cursor suggestion!
> Please run `rustfmt` on drivers/android/binder/range_alloc/tree.rs.
I've run rustfmt on the file for v2.
> ... use `self.free_tree.cursor_lower_bound_mut()`
> and `cursor.remove_current().1.into_reservation()` ...
I used that approach in v2. I keep the cursor while I look up the
descriptor, then use it to remove the selected node and save its
reservation for release. That drops the second lookup and the
unreachable EINVAL path. In my local comparison, the cursor was
generally faster with several free ranges and roughly even with one.
Thanks,
Peder