[PATCH 3/4] rust_binder: thread: wire up `transaction_buffer` `alloc/release` tracepoints
From: Sagar Taunk
Date: Sun Sep 27 2026 - 08:57:32 EST
Call `trace_transaction_alloc_buf()` right after a transaction buffer
is successfully allocated in `copy_transaction_data()`, and call
`trace_transaction_buffer_release()` when a buffer is freed via
`BC_FREE_BUFFER` in `Thread::write()`.
Signed-off-by: Sagar Taunk <sagartaunk@xxxxxxxxx>
---
drivers/android/binder/thread.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index 18a14aa8a835..9678c0decc7f 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -30,6 +30,7 @@
process::{GetWorkOrRegister, Process},
ptr_align,
stats::GLOBAL_STATS,
+ trace::{trace_transaction_alloc_buf, trace_transaction_buffer_release},
transaction::{Transaction, TransactionFlag, TransactionFlags, TransactionInfo},
BinderReturnWriter, DArc, DLArc, DTRWrap, DeliverCode, DeliverToRead,
};
@@ -1046,6 +1047,8 @@ pub(crate) fn copy_transaction_data(
}
};
+ trace_transaction_alloc_buf(debug_id, data_size, offsets_size, buffers_size);
+
let mut buffer_reader = UserSlice::new(info.data_ptr, data_size).reader();
let mut end_of_previous_object = 0;
let mut sg_state = None;
@@ -1483,6 +1486,7 @@ fn write(self: &Arc<Self>, req: &mut BinderWriteRead) -> Result {
if buffer.looper_need_return_on_free() {
self.inner.lock().looper_need_return = true;
}
+ trace_transaction_buffer_release(buffer.debug_id);
drop(buffer);
}
}
--
2.55.0