Skip to content
Next Next commit
gh-149584: Avoid page reads for hot profiler structs
Use exact remote reads for interpreter state, thread state, and
interpreter frame structs instead of pulling full remote pages into the
profiler page cache. This matches the core change from
#149585.
  • Loading branch information
pablogsal committed May 10, 2026
commit c5520d361c87a7993799e3e98db335d83aec7070
2 changes: 1 addition & 1 deletion Modules/_remote_debugging/frames.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ parse_frame_object(
char frame[SIZEOF_INTERP_FRAME];
*address_of_code_object = 0;

Py_ssize_t bytes_read = _Py_RemoteDebug_PagedReadRemoteMemory(
Py_ssize_t bytes_read = _Py_RemoteDebug_ReadRemoteMemory(
&unwinder->handle,
address,
SIZEOF_INTERP_FRAME,
Expand Down
2 changes: 1 addition & 1 deletion Modules/_remote_debugging/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ _remote_debugging_RemoteUnwinder_get_stack_trace_impl(RemoteUnwinderObject *self
while (current_interpreter != 0) {
// Read interpreter state to get the interpreter ID
char interp_state_buffer[INTERP_STATE_BUFFER_SIZE];
if (_Py_RemoteDebug_PagedReadRemoteMemory(
if (_Py_RemoteDebug_ReadRemoteMemory(
&self->handle,
current_interpreter,
INTERP_STATE_BUFFER_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion Modules/_remote_debugging/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ unwind_stack_for_thread(
StackChunkList chunks = {0};

char ts[SIZEOF_THREAD_STATE];
int bytes_read = _Py_RemoteDebug_PagedReadRemoteMemory(
int bytes_read = _Py_RemoteDebug_ReadRemoteMemory(
&unwinder->handle, *current_tstate, (size_t)unwinder->debug_offsets.thread_state.size, ts);
if (bytes_read < 0) {
set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to read thread state");
Expand Down