diff options
author | Kostya Serebryany <kcc@google.com> | 2015-01-21 02:05:31 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2015-01-21 02:05:31 +0000 |
commit | f403e531abe8f3472056fadbc8c12fa8438e150a (patch) | |
tree | db3253b1c811fbc3212a6d7ea2556b5a25297fef /lib/asan/asan_rtl.cc | |
parent | 61df5b172dc3908c8b87fdad5f9cc2fbbdb5703a (diff) |
[asan] use MADV_NOHUGEPAGE for shadow to reduce the actual memory usage
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_rtl.cc')
-rw-r--r-- | lib/asan/asan_rtl.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc index 63cbb3f6f..953935b1c 100644 --- a/lib/asan/asan_rtl.cc +++ b/lib/asan/asan_rtl.cc @@ -86,7 +86,8 @@ void ShowStatsAndAbort() { // ---------------------- mmap -------------------- {{{1 // Reserve memory range [beg, end]. -static void ReserveShadowMemoryRange(uptr beg, uptr end) { +// We need to use inclusive range because end+1 may not be representable. +void ReserveShadowMemoryRange(uptr beg, uptr end) { CHECK_EQ((beg % GetPageSizeCached()), 0); CHECK_EQ(((end + 1) % GetPageSizeCached()), 0); uptr size = end - beg + 1; @@ -97,6 +98,8 @@ static void ReserveShadowMemoryRange(uptr beg, uptr end) { "Perhaps you're using ulimit -v\n", size); Abort(); } + if (common_flags()->no_huge_pages_for_shadow) + NoHugePagesInRegion(beg, size); } // --------------- LowLevelAllocateCallbac ---------- {{{1 |