Skip to content

Commit 86bfe12

Browse files
author
Pablo Galindo Salgado
committed
windows flags
1 parent 16ecc7e commit 86bfe12

File tree

9 files changed

+147930
-1
lines changed

9 files changed

+147930
-1
lines changed

Doc/using/configure.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,9 @@ also be used to improve performance.
793793
The configure script checks that the platform supports ``MAP_HUGETLB``
794794
and emits a warning if it is not available.
795795

796+
On Windows, use the ``--pymalloc-hugepages`` flag with ``build.bat`` or
797+
set the ``UsePymallocHugepages`` MSBuild property.
798+
796799
.. versionadded:: 3.15
797800

798801
.. option:: --without-doc-strings

Doc/whatsnew/3.15.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,7 @@ Build changes
14811481
page support for :ref:`pymalloc <pymalloc>` arenas. When enabled, arena size
14821482
increases to 2 MiB and allocation uses ``MAP_HUGETLB`` (Linux) or
14831483
``MEM_LARGE_PAGES`` (Windows) with automatic fallback to regular pages.
1484+
On Windows, use ``build.bat --pymalloc-hugepages``.
14841485

14851486
* Annotating anonymous mmap usage is now supported if Linux kernel supports
14861487
:manpage:`PR_SET_VMA_ANON_NAME <PR_SET_VMA(2const)>` (Linux 5.17 or newer).
15 KB
Binary file not shown.
1.2 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix race conditions during runtime finalization that could lead to accessing
2+
freed memory.

PCbuild/build.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ echo. --experimental-jit-interpreter Enable the experimental Tier 2 interprete
4242
echo. --pystats Enable PyStats collection.
4343
echo. --tail-call-interp Enable tail-calling interpreter (requires LLVM 19 or higher).
4444
echo. --enable-stackref-debug Enable stackref debugging mode.
45+
echo. --pymalloc-hugepages Enable huge page support for pymalloc arenas.
4546
echo.
4647
echo.Available flags to avoid building certain modules.
4748
echo.These flags have no effect if '-e' is not given:
@@ -100,6 +101,7 @@ if "%~1"=="--without-remote-debug" (set DisableRemoteDebug=true) & shift & goto
100101
if "%~1"=="--pystats" (set PyStats=1) & shift & goto CheckOpts
101102
if "%~1"=="--tail-call-interp" (set UseTailCallInterp=true) & shift & goto CheckOpts
102103
if "%~1"=="--enable-stackref-debug" (set StackRefDebug=true) & shift & goto CheckOpts
104+
if "%~1"=="--pymalloc-hugepages" (set UsePymallocHugepages=true) & shift & goto CheckOpts
103105
rem These use the actual property names used by MSBuild. We could just let
104106
rem them in through the environment, but we specify them on the command line
105107
rem anyway for visibility so set defaults after this
@@ -205,6 +207,7 @@ echo on
205207
/p:UseTailCallInterp=%UseTailCallInterp%^
206208
/p:DisableRemoteDebug=%DisableRemoteDebug%^
207209
/p:StackRefDebug=%StackRefDebug%^
210+
/p:UsePymallocHugepages=%UsePymallocHugepages%^
208211
%1 %2 %3 %4 %5 %6 %7 %8 %9
209212

210213
@echo off

PCbuild/pyproject.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@
5050
<_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition)</_PlatformPreprocessorDefinition>
5151
<_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)$(PyDebugExt)";</_Py3NamePreprocessorDefinition>
5252
<_FreeThreadedPreprocessorDefinition Condition="$(DisableGil) == 'true'">Py_GIL_DISABLED=1;</_FreeThreadedPreprocessorDefinition>
53+
<_PymallocHugepagesPreprocessorDefinition Condition="$(UsePymallocHugepages) == 'true'">PYMALLOC_USE_HUGEPAGES=1;</_PymallocHugepagesPreprocessorDefinition>
5354
</PropertyGroup>
5455
<ItemDefinitionGroup>
5556
<ClCompile>
5657
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
57-
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition)$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)$(_FreeThreadedPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
58+
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition)$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)$(_FreeThreadedPreprocessorDefinition)$(_PymallocHugepagesPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
5859
<PreprocessorDefinitions Condition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5960

6061
<Optimization>MaxSpeed</Optimization>

PCbuild/readme.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ Supported flags are:
359359
* WITH_COMPUTED_GOTOS: build the interpreter using "computed gotos".
360360
Currently only supported by clang-cl.
361361

362+
* UsePymallocHugepages: enable huge page support for pymalloc arenas.
363+
When enabled, the arena size on 64-bit platforms is increased to 2 MiB
364+
and arena allocation uses MEM_LARGE_PAGES with automatic fallback to
365+
regular pages. Can also be enabled via `--pymalloc-hugepages` flag.
366+
362367

363368
Static library
364369
--------------

0 commit comments

Comments
 (0)