gh-142419: Add mmap.set_name method for user custom annotation (gh-142480)

This commit is contained in:
Donghee Na 2025-12-18 23:33:49 +09:00 committed by GitHub
parent d2abd5733b
commit 14f0b5191a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 159 additions and 14 deletions

View file

@ -77,7 +77,7 @@ jit_alloc(size_t size)
unsigned char *memory = mmap(NULL, size, prot, flags, -1, 0);
int failed = memory == MAP_FAILED;
if (!failed) {
_PyAnnotateMemoryMap(memory, size, "cpython:jit");
(void)_PyAnnotateMemoryMap(memory, size, "cpython:jit");
}
#endif
if (failed) {

View file

@ -1086,7 +1086,8 @@ static void* perf_map_jit_init(void) {
close(fd);
return NULL; // Memory mapping failed
}
_PyAnnotateMemoryMap(perf_jit_map_state.mapped_buffer, page_size, "cpython:perf_jit_trampoline");
(void)_PyAnnotateMemoryMap(perf_jit_map_state.mapped_buffer, page_size,
"cpython:perf_jit_trampoline");
#endif
perf_jit_map_state.mapped_size = page_size;

View file

@ -291,7 +291,7 @@ new_code_arena(void)
perf_status = PERF_STATUS_FAILED;
return -1;
}
_PyAnnotateMemoryMap(memory, mem_size, "cpython:perf_trampoline");
(void)_PyAnnotateMemoryMap(memory, mem_size, "cpython:perf_trampoline");
void *start = &_Py_trampoline_func_start;
void *end = &_Py_trampoline_func_end;
size_t code_size = end - start;