summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.h
diff options
context:
space:
mode:
authorLokesh Gidra <lokeshgidra@google.com>2020-02-12 18:10:32 -0800
committerLokesh Gidra <lokeshgidra@google.com>2020-05-01 18:22:13 +0000
commit315f1b21a51a67e5d9c9ec3a04f1887931061e10 (patch)
tree4d736d750c5839395aac65a48bd3935a9831cdbc /compiler/optimizing/code_generator.h
parent0f5b2bf1aee7e08ce3b0dbf91ee528eb846d372f (diff)
Use MADV_FREE to reclaim pages of freed regions
In order to release memory consumed by freed regions back to kernel we use madvise(MADV_DONTNEED) syscall, which synchronously takes away all the pages of the given memory range. As a side-effect, this also provides us clean (zeroed-out) pages the next time region is used by an application thread as a TLAB. The downside is overhead of MADV_DONTNEED (it has to manipulate all the corresponding page-table entries). Furthermore, the application thread gets page fault each time it moves from one page to the next while consuming the TLAB. MADV_FREE is another madvise option that also advises kernel to take away the pages, but only when there is memory pressure. It is a much more light-weight operation than MADV_DONTNEED. Also, the application thread doesn't get the page fault overhead, if the page is not already reclaimed. However, a page which is not reclaimed by the kernel will have stale data on it. This change uses MADV_FREE for region-space's reclamation and ensures that pages about to be used for new allocations are properly cleared. Bug: 74447417 Bug: 140130889 Test: Golem, mpts/greenday tests Change-Id: I1e4a75abed51844d5062685bf77871f609af5a65
Diffstat (limited to 'compiler/optimizing/code_generator.h')
0 files changed, 0 insertions, 0 deletions