tsan: use MADV_NOHUGEPAGE only if it is supported by platform

Fixes build failure on an old system:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-centos-6.5/builds/7555/steps/build/logs/stdio

llvm-svn: 214394
This commit is contained in:
Dmitry Vyukov 2014-07-31 08:24:59 +00:00
parent 45bf56cdf9
commit b7e8e5cdc0
1 changed files with 2 additions and 0 deletions

View File

@ -232,8 +232,10 @@ void InitializeShadowMemory() {
// 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.
#ifdef MADV_NOHUGEPAGE
madvise((void*)MemToShadow(0x7f0000000000ULL),
0x10000000000ULL * kShadowMultiplier, MADV_NOHUGEPAGE);
#endif
DPrintf("memory shadow: %zx-%zx (%zuGB)\n",
kLinuxShadowBeg, kLinuxShadowEnd,
(kLinuxShadowEnd - kLinuxShadowBeg) >> 30);