Skip to content

Commit c5520d3

Browse files
committed
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.
1 parent a8e3247 commit c5520d3

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/_remote_debugging/frames.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ parse_frame_object(
197197
char frame[SIZEOF_INTERP_FRAME];
198198
*address_of_code_object = 0;
199199

200-
Py_ssize_t bytes_read = _Py_RemoteDebug_PagedReadRemoteMemory(
200+
Py_ssize_t bytes_read = _Py_RemoteDebug_ReadRemoteMemory(
201201
&unwinder->handle,
202202
address,
203203
SIZEOF_INTERP_FRAME,

Modules/_remote_debugging/module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ _remote_debugging_RemoteUnwinder_get_stack_trace_impl(RemoteUnwinderObject *self
537537
while (current_interpreter != 0) {
538538
// Read interpreter state to get the interpreter ID
539539
char interp_state_buffer[INTERP_STATE_BUFFER_SIZE];
540-
if (_Py_RemoteDebug_PagedReadRemoteMemory(
540+
if (_Py_RemoteDebug_ReadRemoteMemory(
541541
&self->handle,
542542
current_interpreter,
543543
INTERP_STATE_BUFFER_SIZE,

Modules/_remote_debugging/threads.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ unwind_stack_for_thread(
303303
StackChunkList chunks = {0};
304304

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

0 commit comments

Comments
 (0)