https://github.com/python/cpython/commit/51107387797887b91f0dd69090a30c88a7997aac
commit: 51107387797887b91f0dd69090a30c88a7997aac
branch: main
author: Maurycy Pawłowski-Wieroński <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-04-30T22:18:07+01:00
summary:

gh-144319: Use transparent huge pages via `madvise(MADV_HUGEPAGE)` in pymalloc 
(#144353)

files:
M Objects/obmalloc.c

diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index e2d5b012955c3e..1809bd30451327 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to