rust_binder: speed up get_node_debug_info using lower_bound iter

Finding the next node in the RBTree can be done more efficiently using
the cursor_lower_bound, as it reduces cost from O(n) to O(log n).

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://github.com/Rust-for-Linux/linux/issues/1249
Suggested-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Rafael Passos <rafael@rcpassos.me>
Link: https://patch.msgid.link/20260814215145.2050599-1-rafael@rcpassos.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Rafael Passos authored and Greg Kroah-Hartman committed 2026-09-17 10:22:00 +01:00
1 parent cad5591bc0
commit f344930a16
1 file changed
+4 -5
+4 -5
View File
@@ -1216,11 +1216,10 @@ impl Process {
{
let inner = self.inner.lock();
for (node_ptr, node) in &inner.nodes {
if *node_ptr > ptr {
node.populate_debug_info(&mut out, &inner);
break;
}
// cursor_lower_bound retrieves the "key" passed or the next existing larger key
if let Some(cursor) = inner.nodes.cursor_lower_bound(&(ptr + 1)) {
let (_, node) = cursor.current();
node.populate_debug_info(&mut out, &inner);
}
}