Commit ffbc4737 authored by OlivierLi's avatar OlivierLi Committed by Commit Bot

Remove BlobMemoryController intervention to critical memory pressure

Under critical memory pressure the system is probably already swapping
out memory and making heavy use of IO. Adding to that is not desirable.
Furthermore, scheduling a task to write files to disk risks paging-in
memory that was already committed to disk which compounds the problem.

Bug: 1087530
Change-Id: I2f5ba6e703eef0d804e6f4d99dd504c7eadf7740
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227029Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Reviewed-by: default avatarSébastien Marchand <sebmarchand@chromium.org>
Commit-Queue: Oliver Li <olivierli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774376}
parent f5036cd4
...@@ -1039,13 +1039,19 @@ void BlobMemoryController::OnEvictionComplete( ...@@ -1039,13 +1039,19 @@ void BlobMemoryController::OnEvictionComplete(
void BlobMemoryController::OnMemoryPressure( void BlobMemoryController::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
// TODO(sebmarchand): Check if MEMORY_PRESSURE_LEVEL_MODERATE should also be // Under critical memory pressure the system is probably already swapping out
// ignored. // memory and making heavy use of IO. Adding to that is not desirable.
// Furthermore, scheduling a task to write files to disk risks paging-in
// memory that was already committed to disk which compounds the problem. Do
// not take any action on critical memory pressure.
if (memory_pressure_level == if (memory_pressure_level ==
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE) { base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) {
return; return;
} }
// TODO(crbug.com/1087530): Run trial to see if we should get rid of this
// whole intervention or leave it on for MEMORY_PRESSURE_LEVEL_MODERATE.
auto time_from_last_evicion = base::TimeTicks::Now() - last_eviction_time_; auto time_from_last_evicion = base::TimeTicks::Now() - last_eviction_time_;
if (last_eviction_time_ != base::TimeTicks() && if (last_eviction_time_ != base::TimeTicks() &&
time_from_last_evicion.InSeconds() < kMinSecondsForPressureEvictions) { time_from_last_evicion.InSeconds() < kMinSecondsForPressureEvictions) {
......
...@@ -1156,7 +1156,7 @@ TEST_F(BlobMemoryControllerTest, OnMemoryPressure) { ...@@ -1156,7 +1156,7 @@ TEST_F(BlobMemoryControllerTest, OnMemoryPressure) {
controller.OnMemoryPressure( controller.OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel:: base::MemoryPressureListener::MemoryPressureLevel::
MEMORY_PRESSURE_LEVEL_CRITICAL); MEMORY_PRESSURE_LEVEL_MODERATE);
EXPECT_TRUE(file_runner_->HasPendingTask()); EXPECT_TRUE(file_runner_->HasPendingTask());
RunFileThreadTasks(); RunFileThreadTasks();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment