diff --git a/_content/doc/gc-guide.html b/_content/doc/gc-guide.html index 2fe7c735..51395c2d 100644 --- a/_content/doc/gc-guide.html +++ b/_content/doc/gc-guide.html @@ -1539,7 +1539,7 @@ we recommend the following additional settings for Go programs.

  • -

    +

    Set /sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_none to 0.
    @@ -1551,8 +1551,18 @@ we recommend the following additional settings for Go programs. runtime does to return memory to the OS. Before Go 1.21, the Go runtime tried to mitigate the negative effects of the default setting, but it came with a CPU cost. - With Go 1.21+ and Linux 6.2+, the Go runtime will coalesce regular pages - into huge pages itself with its own more accurate heuristics. + With Go 1.21+ and Linux 6.2+, the Go runtime no longer mutates huge page + state. +
    +
    + If you experience an increase in memory usage when upgrading to Go 1.21.1 or + later, try applying this setting; it will likely resolve your issue. + As an additional workaround, you can call + the Prctl + function with PR_SET_THP_DISABLE to disable huge pages at + the process level, or you can set GODEBUG=disablethp=1 (to be + added in Go 1.21.6 and Go 1.22) to disable huge pages for heap memory. + Note that the GODEBUG setting may be removed in a future release.

  • diff --git a/_content/doc/go1.21.md b/_content/doc/go1.21.md index 4e849fdd..26d7076f 100644 --- a/_content/doc/go1.21.md +++ b/_content/doc/go1.21.md @@ -231,7 +231,13 @@ now manages which parts of the heap may be backed by huge pages more explicitly. This leads to better utilization of memory: small heaps should see less memory used (up to 50% in pathological cases) while large heaps should see fewer broken huge pages for dense parts of the -heap, improving CPU usage and latency by up to 1%. +heap, improving CPU usage and latency by up to 1%. A consequence of this +change is that the runtime no longer tries to work around a particular +problematic Linux configuration setting, which may result in higher +memory overheads. The recommended fix is to adjust the OS's huge page +settings according to the [GC guide](/doc/gc-guide#Linux_transparent_huge_pages). +However, other workarounds are available as well. See the [section on +`max_ptes_none`](/doc/gc-guide#Linux_THP_max_ptes_none_workaround). As a result of runtime-internal garbage collection tuning,