]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-144319: Use transparent huge pages via `madvise(MADV_HUGEPAGE)` in pymalloc (...
authorMaurycy Pawłowski-Wieroński <maurycy@maurycy.com>
Thu, 30 Apr 2026 21:18:07 +0000 (23:18 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Apr 2026 21:18:07 +0000 (22:18 +0100)
Objects/obmalloc.c

index e2d5b012955c3e88299754020d9b52e7e3bb13e9..1809bd30451327ba1f8fdc933c02794520a053d4 100644 (file)
@@ -665,6 +665,9 @@ _PyMem_ArenaAlloc(void *Py_UNUSED(ctx), size_t size)
     if (ptr == MAP_FAILED)
         return NULL;
     assert(ptr != NULL);
+#ifdef MADV_HUGEPAGE
+    (void)madvise(ptr, size, MADV_HUGEPAGE);
+#endif
     (void)_PyAnnotateMemoryMap(ptr, size, "cpython:pymalloc");
     return ptr;
 #else