rust: binder: Use lower bound for node debug lookup
Subsystems (2)
PATCH 1/1 rust: binder: Use lower bound for node debug lookup
From: ChrisX101010 <[email protected]>
The Binder node debug lookup currently walks the process node RBTree from the beginning until it finds the first node pointer greater than the requested pointer.
Use RBTree::cursor_lower_bound() to start the lookup at the relevant tree position instead. When the lower-bound key is equal to the requested pointer, inspect the next node to preserve the existing strictly-greater-than semantics.
This changes the tree lookup from a linear scan to an O(log n) search without changing the returned node semantics.
--- drivers/android/binder/process.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/android/binder/process.rs +6 -2
@@ -1208,10 +1208,14 @@ fn get_node_debug_info(&self, data: UserSlice) -> Result { {let inner = self.inner.lock (); -for (node_ptr, node)in &inner.nodes { + +if let Some (cursor) = inner.nodes.cursor_lower_bound (&ptr) { +let (node_ptr, node) = cursor.current (); +if *node_ptr > ptr { node.populate_debug_info (&mut out, &inner); -break ; + }else if let Some ((_, node)) = cursor.peek_next () { + node.populate_debug_info (&mut out, &inner); } } }
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerQuoted 1 line · On Mon, Aug 31, 2026 at 07:26:35AM +0200, [email protected] wrote:
From: ChrisX101010 <[email protected]>
We need a real name, thanks.
greg k-h
PATCH v2 1/1 rust: binder: Use lower bound for node debug lookup
In reply to [email protected]From: Hristos Nenkov <[email protected]>
The Binder node debug lookup currently walks the process node RBTree from the beginning until it finds the first node pointer greater than the requested pointer.
Use RBTree::cursor_lower_bound() to start the lookup at the relevant tree position instead. When the lower-bound key is equal to the requested pointer, inspect the next node to preserve the existing strictly-greater-than semantics.
This changes the tree lookup from a linear scan to an O(log n) search without changing the returned node semantics.
--- drivers/android/binder/process.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/android/binder/process.rs +6 -2
@@ -1208,10 +1208,14 @@ fn get_node_debug_info(&self, data: UserSlice) -> Result { {let inner = self.inner.lock (); -for (node_ptr, node)in &inner.nodes { + +if let Some (cursor) = inner.nodes.cursor_lower_bound (&ptr) { +let (node_ptr, node) = cursor.current (); +if *node_ptr > ptr { node.populate_debug_info (&mut out, &inner); -break ; + }else if let Some ((_, node)) = cursor.peek_next () { + node.populate_debug_info (&mut out, &inner); } } }
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerQuoted 14 lines · On Mon, Aug 31, 2026 at 07:49:20AM +0200, [email protected] wrote:
From: Hristos Nenkov <[email protected]>
The Binder node debug lookup currently walks the process node RBTree from the beginning until it finds the first node pointer greater than the requested pointer.
Use
RBTree::cursor_lower_bound()to start the lookup at the relevant tree position instead. When the lower-bound key is equal to the requested pointer, inspect the next node to preserve the existing strictly-greater-than semantics.This changes the tree lookup from a linear scan to an O(log n) search without changing the returned node semantics.
Quoted 6 lines
Suggested-by Alice Ryhl <[email protected]>Signed-off-by Hristos Nenkov <[email protected]>--- drivers/android/binder/process.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
This does not apply to the char-misc-testing branch :(
Alice Ryhl
maintainerQuoted 16 lines · Greg Kroah-Hartman
Quoted 14 lines · On Mon, Aug 31, 2026 at 07:49:20AM +0200, [email protected] wrote:
From: Hristos Nenkov <[email protected]>
The Binder node debug lookup currently walks the process node RBTree from the beginning until it finds the first node pointer greater than the requested pointer.
Use
RBTree::cursor_lower_bound()to start the lookup at the relevant tree position instead. When the lower-bound key is equal to the requested pointer, inspect the next node to preserve the existing strictly-greater-than semantics.This changes the tree lookup from a linear scan to an O(log n) search without changing the returned node semantics.
Quoted 8 lines
Quoted 6 lines
Suggested-by Alice Ryhl <[email protected]>Signed-off-by Hristos Nenkov <[email protected]>--- drivers/android/binder/process.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)This does not apply to the char-misc-testing branch :(
Please check this instead:
https://lore.kernel.org/all/[email protected]/
This one is a duplicate, and I prefer the other one.
Alice
Greg Kroah-Hartman
maintainerQuoted 25 lines · Alice Ryhl
Quoted 23 lines · Greg Kroah-Hartman
Quoted 20 lines · On Mon, Aug 31, 2026 at 07:49:20AM +0200, [email protected] wrote:
From: Hristos Nenkov <[email protected]>
The Binder node debug lookup currently walks the process node RBTree from the beginning until it finds the first node pointer greater than the requested pointer.
Use
RBTree::cursor_lower_bound()to start the lookup at the relevant tree position instead. When the lower-bound key is equal to the requested pointer, inspect the next node to preserve the existing strictly-greater-than semantics.This changes the tree lookup from a linear scan to an O(log n) search without changing the returned node semantics.
Suggested-by Alice Ryhl <[email protected]>Signed-off-by Hristos Nenkov <[email protected]>--- drivers/android/binder/process.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 1 line
This does not apply to the char-misc-testing branch :(
Please check this instead:
https://lore.kernel.org/all/[email protected]/This one is a duplicate, and I prefer the other one.
Ah good, I already took that one :)
thanks,
greg k-h
Alice Ryhl
maintainerQuoted 11 lines · On Mon, Aug 31, 2026 at 07:26:35AM +0200, [email protected] wrote:
From: ChrisX101010 <[email protected]>
The Binder node debug lookup currently walks the process node RBTree from the beginning until it finds the first node pointer greater than the requested pointer.
Use
RBTree::cursor_lower_bound()to start the lookup at the relevant tree position instead. When the lower-bound key is equal to the requested pointer, inspect the next node to preserve the existing strictly-greater-than semantics.
Quoted 6 lines
This changes the tree lookup from a linear scan to an O(log n) search without changing the returned node semantics.
Suggested-by Alice Ryhl <[email protected]>Signed-off-by ChrisX101010 <[email protected]>
This is a duplicate: