From: Maurycy Pawłowski-Wieroński Date: Thu, 30 Apr 2026 21:18:07 +0000 (+0200) Subject: gh-144319: Use transparent huge pages via `madvise(MADV_HUGEPAGE)` in pymalloc (... X-Git-Tag: v3.15.0b1~149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51107387797887b91f0dd69090a30c88a7997aac;p=thirdparty%2FPython%2Fcpython.git gh-144319: Use transparent huge pages via `madvise(MADV_HUGEPAGE)` in pymalloc (#144353) --- diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index e2d5b012955c..1809bd304513 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