[hwasan] Madvise away unused shadow.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Sat, 19 Jan 2019 01:54:09 +0000 (01:54 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Sat, 19 Jan 2019 01:54:09 +0000 (01:54 +0000)
commitc089fbbaf28698d340e3a958e4e9cee9e519a68c
tree9ae65fbeb4ac59a09f3e068a46874923eecdd045
parent022bf3e8e7b06daf01fbacad224d2bf0c1919a3e
[hwasan] Madvise away unused shadow.

Summary:
Whenever a large shadow region is tagged to zero, madvise(DONT_NEED)
as much of it as possible.

This reduces shadow RSS on Android by 45% or so, and total memory use
by 2-4%, probably even more on long running multithreaded programs.
CPU time seems to be in the noise.

Reviewers: kcc, pcc

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D56757

llvm-svn: 351620
compiler-rt/lib/hwasan/hwasan.cc
compiler-rt/lib/hwasan/hwasan_poisoning.cc
compiler-rt/lib/sanitizer_common/sanitizer_linux.h
compiler-rt/test/hwasan/TestCases/Linux/release-shadow.c [new file with mode: 0644]