-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-141770: Annotate anonymous mmap usage if "-X dev" is used #142079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
cc @picnixz |
|
FYI, Fedora does not support yet even if the kernel version itself already support it. |
Co-authored-by: Bénédikt Tran <[email protected]>
|
FWIW, it would be useful to have an option to enable this in release builds too. |
|
@SpecLad Thanks for the feedback, I will create a separate PR :) |
|
@SpecLad Just out of curiosity, passing the build flag through |
|
To be clear, by "option" I really mean a runtime option. 🙂 It would be pretty annoying to have to rebuild Python just for this. If you compare with other implementations, none of them require a compile-time option:
TBH, I don't see why Python shouldn't also permanently enable this, but I would settle for "off by default, enabled with environment variable or |
|
It's a bit annoying that this would only be supported on Linux. Do we have an option that isn't supported everywhere? |
Include/internal/pycore_mmap.h
Outdated
| #endif | ||
|
|
||
| #if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__) && defined(Py_DEBUG) | ||
| # define _PyAnnotateMemoryMap(addr, size, name) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need macros? it is just to avoid the (unsigned long) cast? If so, I would suggest having a static inline function (but you can have a macro for the no-op case to avoid an empty function) and leave the rest to the compiler. Or if you want to keep a macro, please align the \ (see PEP-7).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also prefer a static inline function for cleaner code.
Include/internal/pycore_mmap.h
Outdated
| #endif | ||
|
|
||
| #if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__) && defined(Py_DEBUG) | ||
| # define _PyAnnotateMemoryMap(addr, size, name) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also prefer a static inline function for cleaner code.
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
corona10
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc/whatsnew/3.15.rst
Outdated
| modules that are missing or packaged separately. | ||
| (Contributed by Stan Ulbrych and Petr Viktorin in :gh:`139707`.) | ||
|
|
||
| * Annotating anonymous mmap usage is now supported if Linux kernel supports ``PR_SET_VMA_ANON_NAME`` (Linux 5.17 or newer). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Annotating anonymous mmap usage is now supported if Linux kernel
supports :manpage:`PR_SET_VMA_ANON_NAME <PR_SET_VMA(2const)>`
(Linux 5.17 or newer).I don't know under which manpage entry it is, but if you locally run Sphinx, you should be able to find the correct one. That way, users would have a link to click on. If there isn't a manpage, nevermind.
Misc/NEWS.d/next/Core_and_Builtins/2025-11-29-18-14-28.gh-issue-141770.JURnvg.rst
Outdated
Show resolved
Hide resolved
…e-141770.JURnvg.rst Co-authored-by: Bénédikt Tran <[email protected]>
Misc/NEWS.d/next/Core_and_Builtins/2025-11-29-18-14-28.gh-issue-141770.JURnvg.rst
Outdated
Show resolved
Hide resolved
…e-141770.JURnvg.rst Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
vstinner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Victor Stinner <[email protected]>
|
|
Please can you check the buildbot failure? |
… used (pythongh-142079)" This reverts commit c4ccaf4.
|
I think it's a problem with the buildbot machine: it's timing out on other branches now, and the builds are taking nearly five hours, when they used to take around 50 minutes: |
|
I just sent an email to David Bolen (the buildbot owner) to ask him to have a look. Something seems to be wrong with this buildbot worker. |
|
This change introduced a regression: #142627. |
|
Note for myself: The feature is not available on Fedora, since Fedora builds the Linux kernel without the |


mmapin_PyMem_ArenaAllocfor debugging #141770