Skip to content

Commit 702ab91

Browse files
committed
Revert "gh-141770: Annotate anonymous mmap usage if "-X dev" is used (gh-142079)"
This reverts commit c4ccaf4.
1 parent 4629567 commit 702ab91

File tree

15 files changed

+1
-107
lines changed

15 files changed

+1
-107
lines changed

Doc/whatsnew/3.15.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,12 +1246,6 @@ Build changes
12461246
modules that are missing or packaged separately.
12471247
(Contributed by Stan Ulbrych and Petr Viktorin in :gh:`139707`.)
12481248

1249-
* Annotating anonymous mmap usage is now supported if Linux kernel supports
1250-
:manpage:`PR_SET_VMA_ANON_NAME <PR_SET_VMA(2const)>` (Linux 5.17 or newer).
1251-
Annotations are visible in ``/proc/<pid>/maps`` if the kernel supports the feature
1252-
and :option:`-X dev <-X>` is passed to the Python or Python is built in :ref:`debug mode <debug-build>`.
1253-
(Contributed by Donghee Na in :gh:`141770`)
1254-
12551249

12561250
Porting to Python 3.15
12571251
======================

Include/internal/pycore_mmap.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

Makefile.pre.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,6 @@ PYTHON_HEADERS= \
13781378
$(srcdir)/Include/internal/pycore_long.h \
13791379
$(srcdir)/Include/internal/pycore_memoryobject.h \
13801380
$(srcdir)/Include/internal/pycore_mimalloc.h \
1381-
$(srcdir)/Include/internal/pycore_mmap.h \
13821381
$(srcdir)/Include/internal/pycore_modsupport.h \
13831382
$(srcdir)/Include/internal/pycore_moduleobject.h \
13841383
$(srcdir)/Include/internal/pycore_namespace.h \

Misc/NEWS.d/next/Core_and_Builtins/2025-11-29-18-14-28.gh-issue-141770.JURnvg.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

Modules/_ctypes/malloc_closure.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# endif
1515
#endif
1616
#include "ctypes.h"
17-
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()
1817

1918
/* BLOCKSIZE can be adjusted. Larger blocksize will take a larger memory
2019
overhead, but allocate less blocks from the system. It may be that some
@@ -75,16 +74,14 @@ static void more_core(void)
7574
if (item == NULL)
7675
return;
7776
#else
78-
size_t mem_size = count * sizeof(ITEM);
7977
item = (ITEM *)mmap(NULL,
80-
mem_size,
78+
count * sizeof(ITEM),
8179
PROT_READ | PROT_WRITE | PROT_EXEC,
8280
MAP_PRIVATE | MAP_ANONYMOUS,
8381
-1,
8482
0);
8583
if (item == (void *)MAP_FAILED)
8684
return;
87-
_PyAnnotateMemoryMap(item, mem_size, "cpython:ctypes");
8885
#endif
8986

9087
#ifdef MALLOC_CLOSURE_DEBUG

Modules/mmapmodule.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
2727
#include "pycore_bytesobject.h" // _PyBytes_Find()
2828
#include "pycore_fileutils.h" // _Py_stat_struct
29-
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()
3029
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
3130

3231
#include <stddef.h> // offsetof()
@@ -1952,7 +1951,6 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
19521951
PyErr_SetFromErrno(PyExc_OSError);
19531952
return NULL;
19541953
}
1955-
_PyAnnotateMemoryMap(m_obj->data, map_size, "cpython:mmap");
19561954
m_obj->access = (access_mode)access;
19571955
return (PyObject *)m_obj;
19581956
}

Objects/obmalloc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "Python.h"
44
#include "pycore_interp.h" // _PyInterpreterState_HasFeature
5-
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()
65
#include "pycore_object.h" // _PyDebugAllocatorStats() definition
76
#include "pycore_obmalloc.h"
87
#include "pycore_obmalloc_init.h"
@@ -468,7 +467,6 @@ _PyMem_ArenaAlloc(void *Py_UNUSED(ctx), size_t size)
468467
if (ptr == MAP_FAILED)
469468
return NULL;
470469
assert(ptr != NULL);
471-
_PyAnnotateMemoryMap(ptr, size, "cpython:pymalloc");
472470
return ptr;
473471
#else
474472
return malloc(size);

PCbuild/pythoncore.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@
277277
<ClInclude Include="..\Include\internal\pycore_llist.h" />
278278
<ClInclude Include="..\Include\internal\pycore_lock.h" />
279279
<ClInclude Include="..\Include\internal\pycore_long.h" />
280-
<ClInclude Include="..\Include\internal\pycore_mmap.h" />
281280
<ClInclude Include="..\Include\internal\pycore_modsupport.h" />
282281
<ClInclude Include="..\Include\internal\pycore_moduleobject.h" />
283282
<ClInclude Include="..\Include\internal\pycore_namespace.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,6 @@
735735
<ClInclude Include="..\Include\internal\pycore_long.h">
736736
<Filter>Include\internal</Filter>
737737
</ClInclude>
738-
<ClInclude Include="..\Include\internal\pycore_mmap.h">
739-
<Filter>Include\internal</Filter>
740-
</ClInclude>
741738
<ClInclude Include="..\Include\internal\pycore_modsupport.h">
742739
<Filter>Include\internal</Filter>
743740
</ClInclude>

Python/jit.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "pycore_intrinsics.h"
1717
#include "pycore_list.h"
1818
#include "pycore_long.h"
19-
#include "pycore_mmap.h"
2019
#include "pycore_opcode_metadata.h"
2120
#include "pycore_opcode_utils.h"
2221
#include "pycore_optimizer.h"
@@ -76,9 +75,6 @@ jit_alloc(size_t size)
7675
int prot = PROT_READ | PROT_WRITE;
7776
unsigned char *memory = mmap(NULL, size, prot, flags, -1, 0);
7877
int failed = memory == MAP_FAILED;
79-
if (!failed) {
80-
_PyAnnotateMemoryMap(memory, size, "cpython:jit");
81-
}
8278
#endif
8379
if (failed) {
8480
jit_error("unable to allocate memory");

0 commit comments

Comments
 (0)