Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1246,12 +1246,6 @@ Build changes
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
:manpage:`PR_SET_VMA_ANON_NAME <PR_SET_VMA(2const)>` (Linux 5.17 or newer).
Annotations are visible in ``/proc/<pid>/maps`` if the kernel supports the feature
and :option:`-X dev <-X>` is passed to the Python or Python is built in :ref:`debug mode <debug-build>`.
(Contributed by Donghee Na in :gh:`141770`)


Porting to Python 3.15
======================
Expand Down
45 changes: 0 additions & 45 deletions Include/internal/pycore_mmap.h

This file was deleted.

1 change: 0 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,6 @@ PYTHON_HEADERS= \
$(srcdir)/Include/internal/pycore_long.h \
$(srcdir)/Include/internal/pycore_memoryobject.h \
$(srcdir)/Include/internal/pycore_mimalloc.h \
$(srcdir)/Include/internal/pycore_mmap.h \
$(srcdir)/Include/internal/pycore_modsupport.h \
$(srcdir)/Include/internal/pycore_moduleobject.h \
$(srcdir)/Include/internal/pycore_namespace.h \
Expand Down

This file was deleted.

5 changes: 1 addition & 4 deletions Modules/_ctypes/malloc_closure.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# endif
#endif
#include "ctypes.h"
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()

/* BLOCKSIZE can be adjusted. Larger blocksize will take a larger memory
overhead, but allocate less blocks from the system. It may be that some
Expand Down Expand Up @@ -75,16 +74,14 @@ static void more_core(void)
if (item == NULL)
return;
#else
size_t mem_size = count * sizeof(ITEM);
item = (ITEM *)mmap(NULL,
mem_size,
count * sizeof(ITEM),
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS,
-1,
0);
if (item == (void *)MAP_FAILED)
return;
_PyAnnotateMemoryMap(item, mem_size, "cpython:ctypes");
#endif

#ifdef MALLOC_CLOSURE_DEBUG
Expand Down
2 changes: 0 additions & 2 deletions Modules/mmapmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
#include "pycore_bytesobject.h" // _PyBytes_Find()
#include "pycore_fileutils.h" // _Py_stat_struct
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()

#include <stddef.h> // offsetof()
Expand Down Expand Up @@ -1952,7 +1951,6 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
_PyAnnotateMemoryMap(m_obj->data, map_size, "cpython:mmap");
m_obj->access = (access_mode)access;
return (PyObject *)m_obj;
}
Expand Down
2 changes: 0 additions & 2 deletions Objects/obmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "Python.h"
#include "pycore_interp.h" // _PyInterpreterState_HasFeature
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()
#include "pycore_object.h" // _PyDebugAllocatorStats() definition
#include "pycore_obmalloc.h"
#include "pycore_obmalloc_init.h"
Expand Down Expand Up @@ -468,7 +467,6 @@ _PyMem_ArenaAlloc(void *Py_UNUSED(ctx), size_t size)
if (ptr == MAP_FAILED)
return NULL;
assert(ptr != NULL);
_PyAnnotateMemoryMap(ptr, size, "cpython:pymalloc");
return ptr;
#else
return malloc(size);
Expand Down
1 change: 0 additions & 1 deletion PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@
<ClInclude Include="..\Include\internal\pycore_llist.h" />
<ClInclude Include="..\Include\internal\pycore_lock.h" />
<ClInclude Include="..\Include\internal\pycore_long.h" />
<ClInclude Include="..\Include\internal\pycore_mmap.h" />
<ClInclude Include="..\Include\internal\pycore_modsupport.h" />
<ClInclude Include="..\Include\internal\pycore_moduleobject.h" />
<ClInclude Include="..\Include\internal\pycore_namespace.h" />
Expand Down
3 changes: 0 additions & 3 deletions PCbuild/pythoncore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,6 @@
<ClInclude Include="..\Include\internal\pycore_long.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_mmap.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_modsupport.h">
<Filter>Include\internal</Filter>
</ClInclude>
Expand Down
4 changes: 0 additions & 4 deletions Python/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "pycore_intrinsics.h"
#include "pycore_list.h"
#include "pycore_long.h"
#include "pycore_mmap.h"
#include "pycore_opcode_metadata.h"
#include "pycore_opcode_utils.h"
#include "pycore_optimizer.h"
Expand Down Expand Up @@ -76,9 +75,6 @@ jit_alloc(size_t size)
int prot = PROT_READ | PROT_WRITE;
unsigned char *memory = mmap(NULL, size, prot, flags, -1, 0);
int failed = memory == MAP_FAILED;
if (!failed) {
_PyAnnotateMemoryMap(memory, size, "cpython:jit");
}
#endif
if (failed) {
jit_error("unable to allocate memory");
Expand Down
2 changes: 0 additions & 2 deletions Python/perf_jit_trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#include "pycore_ceval.h" // _PyPerf_Callbacks
#include "pycore_frame.h"
#include "pycore_interp.h"
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()
#include "pycore_runtime.h" // _PyRuntime

#ifdef PY_HAVE_PERF_TRAMPOLINE
Expand Down Expand Up @@ -1086,7 +1085,6 @@ static void* perf_map_jit_init(void) {
close(fd);
return NULL; // Memory mapping failed
}
_PyAnnotateMemoryMap(perf_jit_map_state.mapped_buffer, page_size, "cpython:perf_jit_trampoline");
#endif

perf_jit_map_state.mapped_size = page_size;
Expand Down
2 changes: 0 additions & 2 deletions Python/perf_trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ any DWARF information available for them).
#include "Python.h"
#include "pycore_ceval.h" // _PyPerf_Callbacks
#include "pycore_interpframe.h" // _PyFrame_GetCode()
#include "pycore_mmap.h" // _PyAnnotateMemoryMap()
#include "pycore_runtime.h" // _PyRuntime


Expand Down Expand Up @@ -291,7 +290,6 @@ new_code_arena(void)
perf_status = PERF_STATUS_FAILED;
return -1;
}
_PyAnnotateMemoryMap(memory, mem_size, "cpython:perf_trampoline");
void *start = &_Py_trampoline_func_start;
void *end = &_Py_trampoline_func_end;
size_t code_size = end - start;
Expand Down
19 changes: 0 additions & 19 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5583,13 +5583,6 @@ AC_CHECK_DECLS([UT_NAMESIZE],
[],
[@%:@include <utmp.h>])

AC_CHECK_DECLS([PR_SET_VMA_ANON_NAME],
[AC_DEFINE([HAVE_PR_SET_VMA_ANON_NAME], [1],
[Define if you have the 'PR_SET_VMA_ANON_NAME' constant.])],
[],
[@%:@include <linux/prctl.h>
@%:@include <sys/prctl.h>])

# check for openpty, login_tty, and forkpty

AC_CHECK_FUNCS([openpty], [],
Expand Down
7 changes: 0 additions & 7 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,6 @@
/* Define to 1 if you have the <db.h> header file. */
#undef HAVE_DB_H

/* Define to 1 if you have the declaration of 'PR_SET_VMA_ANON_NAME', and to 0
if you don't. */
#undef HAVE_DECL_PR_SET_VMA_ANON_NAME

/* Define to 1 if you have the declaration of 'RTLD_DEEPBIND', and to 0 if you
don't. */
#undef HAVE_DECL_RTLD_DEEPBIND
Expand Down Expand Up @@ -1000,9 +996,6 @@
/* Define if your compiler supports function prototype */
#undef HAVE_PROTOTYPES

/* Define if you have the 'PR_SET_VMA_ANON_NAME' constant. */
#undef HAVE_PR_SET_VMA_ANON_NAME

/* Define to 1 if you have the 'pthread_condattr_setclock' function. */
#undef HAVE_PTHREAD_CONDATTR_SETCLOCK

Expand Down
Loading