diff options
| -rw-r--r-- | runtime/gc/space/image_space.cc | 7 | ||||
| -rw-r--r-- | runtime/gc/space/image_space_fs.h | 65 |
2 files changed, 1 insertions, 71 deletions
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index 5484f49e96..d26c32a290 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -3584,14 +3584,9 @@ bool ImageSpace::LoadBootImage( // Step 0: Extra zygote work. - // Step 0.a: If we're the zygote, mark boot. - if (loader.IsZygote() && CanWriteToDalvikCache(image_isa)) { - MarkZygoteStart(image_isa, Runtime::Current()->GetZygoteMaxFailedBoots()); - } - loader.FindImageFiles(); - // Step 0.b: If we're the zygote, check for free space, and prune the cache preemptively, + // Step 0.a: If we're the zygote, check for free space, and prune the cache preemptively, // if necessary. While the runtime may be fine (it is pretty tolerant to // out-of-disk-space situations), other parts of the platform are not. // diff --git a/runtime/gc/space/image_space_fs.h b/runtime/gc/space/image_space_fs.h index 0eab35f41c..c4918937d6 100644 --- a/runtime/gc/space/image_space_fs.h +++ b/runtime/gc/space/image_space_fs.h @@ -104,71 +104,6 @@ static void PruneDalvikCache(InstructionSet isa) { } } -// We write out an empty file to the zygote's ISA specific cache dir at the start of -// every zygote boot and delete it when the boot completes. If we find a file already -// present, it usually means the boot didn't complete. We wipe the entire dalvik -// cache if that's the case. -static void MarkZygoteStart(const InstructionSet isa, const uint32_t max_failed_boots) { - const std::string isa_subdir = GetDalvikCache(GetInstructionSetString(isa)); - CHECK(!isa_subdir.empty()) << "Dalvik cache not found"; - const std::string boot_marker = isa_subdir + "/.booting"; - const char* file_name = boot_marker.c_str(); - - uint32_t num_failed_boots = 0; - std::unique_ptr<File> file(OS::OpenFileReadWrite(file_name)); - if (file.get() == nullptr) { - file.reset(OS::CreateEmptyFile(file_name)); - - if (file.get() == nullptr) { - int saved_errno = errno; - PLOG(WARNING) << "Failed to create boot marker."; - if (saved_errno != ENOSPC) { - return; - } - - LOG(WARNING) << "Pruning dalvik cache because of low-memory situation."; - impl::DeleteDirectoryContents(isa_subdir, false); - - // Try once more. - file.reset(OS::OpenFileReadWrite(file_name)); - if (file == nullptr) { - PLOG(WARNING) << "Failed to create boot marker."; - return; - } - } - } else { - if (!file->ReadFully(&num_failed_boots, sizeof(num_failed_boots))) { - PLOG(WARNING) << "Failed to read boot marker."; - file->Erase(); - return; - } - } - - if (max_failed_boots != 0 && num_failed_boots > max_failed_boots) { - LOG(WARNING) << "Incomplete boot detected. Pruning dalvik cache"; - impl::DeleteDirectoryContents(isa_subdir, false); - } - - ++num_failed_boots; - VLOG(startup) << "Number of failed boots on : " << boot_marker << " = " << num_failed_boots; - - if (lseek(file->Fd(), 0, SEEK_SET) == -1) { - PLOG(WARNING) << "Failed to write boot marker."; - file->Erase(); - return; - } - - if (!file->WriteFully(&num_failed_boots, sizeof(num_failed_boots))) { - PLOG(WARNING) << "Failed to write boot marker."; - file->Erase(); - return; - } - - if (file->FlushCloseOrErase() != 0) { - PLOG(WARNING) << "Failed to flush boot marker."; - } -} - } // namespace space } // namespace gc } // namespace art |