From 1c8906ffa0f7be7de10b4db83ce48da968356105 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 1 Aug 2019 14:27:32 +0100 Subject: [PATCH 1/2] mmap module, track anonymous paging case on macOS --- Modules/mmapmodule.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 51ab3f054f24f6..eb2edba6b99daa 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -54,6 +54,11 @@ my_getallocationgranularity (void) #include #include +#ifdef __APPLE__ +#include +# define MAP_ANON_ID 244 +#endif + #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) static int my_getpagesize(void) @@ -1212,6 +1217,10 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) #ifdef MAP_ANONYMOUS /* BSD way to map anonymous memory */ flags |= MAP_ANONYMOUS; +#ifdef __APPLE__ + /* Darwin allows to tag anonymous memory */ + fd = VM_MAKE_TAG(MAP_ANON_ID); +#endif /* VxWorks only supports MAP_ANONYMOUS with MAP_PRIVATE flag */ #ifdef __VXWORKS__ From d13daacc4f9c2d06924c46d490deb6ec307f0a04 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2019 13:52:53 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS.d/next/macOS/2019-08-01-13-52-52.bpo-37737.1HE5BK.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/macOS/2019-08-01-13-52-52.bpo-37737.1HE5BK.rst diff --git a/Misc/NEWS.d/next/macOS/2019-08-01-13-52-52.bpo-37737.1HE5BK.rst b/Misc/NEWS.d/next/macOS/2019-08-01-13-52-52.bpo-37737.1HE5BK.rst new file mode 100644 index 00000000000000..e81678bb9684dc --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-08-01-13-52-52.bpo-37737.1HE5BK.rst @@ -0,0 +1 @@ +on macOS, anonymous paging cases can be tracked via tooling as vmmap. \ No newline at end of file