I ran into problems with virtual memory fragmentation ggc-page on large LTO builds. The memory was so fragmented that builds failed because the compiler would use more than the 64k mappings Linux allows each process by default.
For more details see PR 50636 This patchkit includes various improvements to the fragmentation behaviour plus some optimizations to increase the use of 2MB pages on modern Linux kernels. This fixes the fragmentation problem for me and increases the use of huge pages significantly. My simple benchmarks didn't show a lot of performance improvement though. On non Linux kernels the fragmentation problem will be still somewhat visible (the best fix is using the Linux specific MADV_DONTNEED), but the new threshold should still improve things there. All passed bootstrap and test suite run on x86-64. -Andi