[Python-checkins] bpo-42232: mmap module add Darwin specific madvise options. (GH-23076)
miss-islington
webhook-mailer at python.org
Sat Nov 21 06:40:00 EST 2020
https://github.com/python/cpython/commit/0e62efc51e31c741b61604787aeab4936e6e50e4
commit: 0e62efc51e31c741b61604787aeab4936e6e50e4
branch: master
author: David CARLIER <devnexen at gmail.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2020-11-21T03:39:56-08:00
summary:
bpo-42232: mmap module add Darwin specific madvise options. (GH-23076)
files:
A Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst
M Doc/library/mmap.rst
M Modules/mmapmodule.c
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
index 698c17653786b..d9825b47c7133 100644
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -337,6 +337,8 @@ MADV_* Constants
MADV_NOCORE
MADV_CORE
MADV_PROTECT
+ MADV_FREE_REUSABLE
+ MADV_FREE_REUSE
These options can be passed to :meth:`mmap.madvise`. Not every option will
be present on every system.
diff --git a/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst b/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst
new file mode 100644
index 0000000000000..d431a9d1e3228
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst
@@ -0,0 +1 @@
+Added Darwin specific madvise options to mmap module.
\ No newline at end of file
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 1e9684970f5d3..1e66962d37b0e 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1667,6 +1667,14 @@ mmap_exec(PyObject *module)
#ifdef MADV_PROTECT
ADD_INT_MACRO(module, MADV_PROTECT);
#endif
+
+ // Darwin-specific
+#ifdef MADV_FREE_REUSABLE // (As MADV_FREE but reclaims more faithful for task_info/Activity Monitor...)
+ ADD_INT_MACRO(module, MADV_FREE_REUSABLE);
+#endif
+#ifdef MADV_FREE_REUSE // (Reuse pages previously tagged as reusable)
+ ADD_INT_MACRO(module, MADV_FREE_REUSE);
+#endif
#endif // HAVE_MADVISE
return 0;
}
More information about the Python-checkins
mailing list