FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-141770: Annotate anonymous mmap usage if "-X dev" is used by corona10 · Pull Request #142079 · python/cpython · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0e3933d
gh-141770: Annotate anonymous mmap only for debug build
corona10 Nov 28, 2025
8b7023e
Apply annotation feature to modules
corona10 Nov 29, 2025
816d962
Add NEWS.d
corona10 Nov 29, 2025
979ce02
nit
corona10 Nov 29, 2025
b3d8547
Update Include/internal/pycore_pymem.h
corona10 Nov 29, 2025
0c5a495
Address code review
corona10 Nov 29, 2025
e757dd9
Address code review
corona10 Nov 29, 2025
cb9509b
Change annotation prefix
corona10 Nov 30, 2025
855742b
nit
corona10 Nov 30, 2025
32cc007
Address code review
corona10 Dec 1, 2025
49b4f95
Apply suggestions from code review
corona10 Dec 2, 2025
1b88b75
Address code review
corona10 Dec 2, 2025
e2eedbc
Address code review
corona10 Dec 2, 2025
a680677
test
corona10 Dec 3, 2025
8ec4d73
Add Include/internal/pycore_mmap.h
corona10 Dec 3, 2025
c0e08b6
fix
corona10 Dec 3, 2025
e66e650
Update PC
corona10 Dec 3, 2025
b0ca751
Update
corona10 Dec 3, 2025
c9138de
Update Whats News
corona10 Dec 3, 2025
8f77e0d
Merge remote-tracking branch 'upstream/main' into gh-141770
corona10 Dec 4, 2025
8706fce
Address code review
corona10 Dec 4, 2025
8ce8281
lint
corona10 Dec 4, 2025
d71a744
Update
corona10 Dec 4, 2025
4dd1ee4
Address code review
corona10 Dec 4, 2025
fee757e
Apply suggestions from code review
corona10 Dec 5, 2025
a240b3c
Update Objects/obmalloc.c
corona10 Dec 5, 2025
805c539
Address code review
corona10 Dec 5, 2025
795d31c
Update Misc/NEWS.d/next/Core_and_Builtins/2025-11-29-18-14-28.gh-issu…
corona10 Dec 5, 2025
be4d550
Address code review
corona10 Dec 5, 2025
290864a
Address code review
corona10 Dec 5, 2025
b287e0c
nit
corona10 Dec 5, 2025
1619f95
Update Misc/NEWS.d/next/Core_and_Builtins/2025-11-29-18-14-28.gh-issu…
corona10 Dec 6, 2025
a1ad592
Update Include/internal/pycore_mmap.h
corona10 Dec 8, 2025
e4e4835
Update Modules/_ctypes/malloc_closure.c
corona10 Dec 8, 2025
0429a0a
Update Include/internal/pycore_mmap.h
corona10 Dec 8, 2025
File filter

Filter by extension

Filter by extension .h  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
Add Include/internal/pycore_mmap.h
  • Loading branch information
corona10 committed Dec 3, 2025
commit 8ec4d73676dbda3f9e28befc3ae1e1c4990efc44
33 changes: 33 additions & 0 deletions Include/internal/pycore_mmap.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef Py_INTERNAL_MMAP_H
#define Py_INTERNAL_MMAP_H

#ifdef __cplusplus
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif

#if defined(Py_DEBUG) && defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
# include <linux/prctl.h>
# include <sys/prctl.h>
#endif

static inline int

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Surely this isn't worth putting into a macro? As a regular function, it will be fully internal, and PGO can inline the parts of it that are appropriate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I prefer static inline functions. I don't see the advantage of using a macro. Inlining or not shouldn't make any difference on performance.

_PyAnnotateMemoryMap(void *addr, size_t size, const char *name)
{
#if defined(Py_DEBUG) && defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
assert(strlen(name) < 80);
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name);
// Ignore errno from prctl
// See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746
errno = 0;
#endif
return 0;
}

#ifdef __cplusplus
}
#endif
#endif // !Py_INTERNAL_MMAP_H

Back | FazBrowse Home | New Git URL