tsan: advise shadow for 0x7f region to not use huge pages

see the comment for justification

llvm-svn: 214030
This commit is contained in:
Dmitry Vyukov 2014-07-26 17:41:10 +00:00
parent 5b1b02eb29
commit 7b70cadae9
1 changed files with 6 additions and 0 deletions

View File

@ -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);