diff options
author | 2022-11-30 06:45:28 +0000 | |
---|---|---|
committer | 2022-12-05 18:17:40 +0000 | |
commit | 49f034785005e53ca51d2af7985e41e4be3d802d (patch) | |
tree | 6961a925bcfdf1a89fa2b22201a7bdd16bff70a7 /runtime/linear_alloc-inl.h | |
parent | 5ac8b698c560e631b0a0e38aaed1445d488da826 (diff) |
Maintain pre-zygote fork linear-alloc pages as shared-clean
Userfaultfd tends to dirty all the pages of the space it is used on.
However, we want to maintain the shared-clean trait of the pages
allocated in zygote process prior to first fork.
This CL separates the pre-zygote fork arenas from the userfaultfd
visited ones, thereby reataining the former's shared-clean trait.
Bug: 160737021
Test: module install and enable uffd GC
Change-Id: Iddffb2c8d2d234ce7b20c069d86341dda5443a9b
Diffstat (limited to 'runtime/linear_alloc-inl.h')
-rw-r--r-- | runtime/linear_alloc-inl.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/linear_alloc-inl.h b/runtime/linear_alloc-inl.h index 928bffbc1c..13dbea11d0 100644 --- a/runtime/linear_alloc-inl.h +++ b/runtime/linear_alloc-inl.h @@ -40,6 +40,12 @@ inline void LinearAlloc::SetFirstObject(void* begin, size_t bytes) const { down_cast<TrackedArena*>(arena)->SetFirstObject(static_cast<uint8_t*>(begin), end); } +inline void LinearAlloc::SetupForPostZygoteFork(Thread* self) { + MutexLock mu(self, lock_); + DCHECK(track_allocations_); + allocator_.ResetCurrentArena(); +} + inline void* LinearAlloc::Realloc(Thread* self, void* ptr, size_t old_size, |