summaryrefslogtreecommitdiff
path: root/thread_pthread_mn.c
diff options
context:
space:
mode:
authorKunshan Wang <[email protected]>2024-11-19 16:07:22 +0800
committerPeter Zhu <[email protected]>2024-11-21 13:48:05 -0500
commit8ae7c22972d82b14d7308e16c26389fa4412727f (patch)
treeeed80cbe686cd9fd206c244785cdb4fa2247fc10 /thread_pthread_mn.c
parent640bacceb19f3ba2b60789a01511e5e280f8b4ce (diff)
Annotate anonymous mmap
Use PR_SET_VMA_ANON_NAME to set human-readable names for anonymous virtual memory areas mapped by `mmap()` when compiled and run on Linux 5.17 or higher. This makes it convenient for developers to debug mmap.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12119
Diffstat (limited to 'thread_pthread_mn.c')
-rw-r--r--thread_pthread_mn.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/thread_pthread_mn.c b/thread_pthread_mn.c
index 08d587e2b2..8508dcaf17 100644
--- a/thread_pthread_mn.c
+++ b/thread_pthread_mn.c
@@ -194,6 +194,8 @@ nt_alloc_thread_stack_chunk(void)
return NULL;
}
+ ruby_annotate_mmap(m, MSTACK_CHUNK_SIZE, "Ruby:nt_alloc_thread_stack_chunk");
+
size_t msz = nt_thread_stack_size();
int header_page_cnt = 1;
int stack_count = ((MSTACK_CHUNK_PAGE_NUM - header_page_cnt) * MSTACK_PAGE_SIZE) / msz;