[compiler-rt] r214030 - tsan: advise shadow for 0x7f region to not use huge pages
Dmitry Vyukov
dvyukov at google.com
Sat Jul 26 10:41:11 PDT 2014
Author: dvyukov
Date: Sat Jul 26 12:41:10 2014
New Revision: 214030
URL: http://llvm.org/viewvc/llvm-project?rev=214030&view=rev
Log:
tsan: advise shadow for 0x7f region to not use huge pages
see the comment for justification
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=214030&r1=214029&r2=214030&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Sat Jul 26 12:41:10 2014
@@ -228,6 +228,12 @@ void InitializeShadowMemory() {
"to link with -pie (%p, %p).\n", shadow, kLinuxShadowBeg);
Die();
}
+ // This memory range is used for thread stacks and large user mmaps.
+ // Frequently a thread uses only a small part of stack and similarly
+ // a program uses a small part of large mmap. On some programs
+ // we see 20% memory usage reduction without huge pages for this range.
+ madvise((void*)MemToShadow(0x7f0000000000ULL),
+ 0x10000000000ULL * kShadowMultiplier, MADV_NOHUGEPAGE);
DPrintf("memory shadow: %zx-%zx (%zuGB)\n",
kLinuxShadowBeg, kLinuxShadowEnd,
(kLinuxShadowEnd - kLinuxShadowBeg) >> 30);
More information about the llvm-commits
mailing list