summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Greg Kaiser <gkaiser@google.com> 2024-09-20 21:45:59 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-09-20 22:48:53 +0000
commited67125787c5ec24285e694e56f6e4f1f7fef1be (patch)
tree5ec83eeaea58f1e6ad89f33184f48715147b89ab
parent4320035f70079c719db05d545f84c5503450cdb2 (diff)
Revert "Do not unmap twice a mapping."
This reverts commit a303efff1731e5b7e9574a4e54701515a4c16d41. Reason for revert: b/368661421, triggers a CHECK in `eng` builds Change-Id: I18b5d87ac6ab5526f24af4daa47c1cf09a33d1b5
-rw-r--r--libartbase/base/mem_map.h26
-rw-r--r--runtime/jit/jit.cc9
2 files changed, 9 insertions, 26 deletions
diff --git a/libartbase/base/mem_map.h b/libartbase/base/mem_map.h
index 4b4a56a23f..a3af44fadb 100644
--- a/libartbase/base/mem_map.h
+++ b/libartbase/base/mem_map.h
@@ -220,28 +220,6 @@ class MemMap {
error_msg);
}
- static MemMap MapFile(size_t byte_count,
- int prot,
- int flags,
- int fd,
- off_t start,
- bool low_4gb,
- const char* filename,
- bool reuse,
- std::string* error_msg) {
- return MapFileAtAddress(nullptr,
- byte_count,
- prot,
- flags,
- fd,
- start,
- /*low_4gb=*/ low_4gb,
- filename,
- reuse,
- /*reservation=*/ nullptr,
- error_msg);
- }
-
// Map part of a file, taking care of non-page aligned offsets. The "start" offset is absolute,
// not relative. This version allows requesting a specific address for the base of the mapping.
//
@@ -447,8 +425,8 @@ class MemMap {
size_t base_size_ = 0u; // Length of mapping. May be changed by RemapAtEnd (ie Zygote).
int prot_ = 0; // Protection of the map.
- // When reuse_ is true, this is a view of a mapping on which
- // we do not take ownership and are not responsible for
+ // When reuse_ is true, this is just a view of an existing mapping
+ // and we do not take ownership and are not responsible for
// unmapping.
bool reuse_ = false;
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index bdfb911003..567f07adf0 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -568,7 +568,6 @@ void Jit::NotifyZygoteCompilationDone() {
/* start= */ 0,
/* low_4gb= */ false,
"boot-image-methods",
- /* reuse= */ true, // The mapping will be reused by the mremaps below.
&error_str);
if (!child_mapping_methods.IsValid()) {
@@ -641,6 +640,10 @@ void Jit::NotifyZygoteCompilationDone() {
// Mark that compilation of boot classpath is done, and memory can now be
// shared. Other processes will pick up this information.
code_cache_->GetZygoteMap()->SetCompilationState(ZygoteCompilationState::kNotifiedOk);
+
+ // The private mapping created for this process has been mremaped. We can
+ // reset it.
+ child_mapping_methods.Reset();
}
class JitCompileTask final : public Task {
@@ -972,7 +975,6 @@ void Jit::MapBootImageMethods() {
/* start= */ 0,
/* low_4gb= */ false,
"boot-image-methods",
- /* reuse= */ true, // The mapping will be reused by the mremaps below.
&error_str);
// We don't need the fd anymore.
@@ -1069,6 +1071,9 @@ void Jit::MapBootImageMethods() {
offset += capacity;
}
+ // The private mapping created for this process has been mremaped. We can
+ // reset it.
+ child_mapping_methods.Reset();
LOG(INFO) << "Successfully mapped boot image methods";
}