Commit a21bf6f9 authored by Siddhartha S's avatar Siddhartha S Committed by Commit Bot

Revert "Reland "Use thresholds based on RAM size for OOM intervention""

This reverts commit 9191004f.

Reason for revert: The failure after the revert was a different failure.
Sorry for the reland.

Original change's description:
> Reland "Use thresholds based on RAM size for OOM intervention"
> 
> This reverts commit 50257b9e.
> 
> Reason for revert: This was not the cause of failure, see
> https://crbug.com/845763
> 
> Original change's description:
> > Revert "Use thresholds based on RAM size for OOM intervention"
> > 
> > This reverts commit 0c2124b3.
> > 
> > Reason for revert: Speculatively reverting to see if it fixes webgl conformance test timeouts
> > Bug: 845411
> > 
> > Original change's description:
> > > Use thresholds based on RAM size for OOM intervention
> > > 
> > > This CL does not change behavior of existing experiment on 512 devices.
> > > 1. Remove low-end device checks while enabling intervention. This can be
> > >    filtered in Finch config.
> > > 2. Set threshold based on percentage of RAM instead of absolute number.
> > > 3. Disable intervention if device has more than 512MB RAM and threshold
> > >    was set to absolute number.
> > > 
> > > BUG=843419
> > > 
> > > 
> > > Change-Id: Ib40a038d9d2f111a514b3f41ce7f32a3ea3a156d
> > > Reviewed-on: https://chromium-review.googlesource.com/1066804
> > > Commit-Queue: Siddhartha S <ssid@chromium.org>
> > > Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
> > > Cr-Commit-Position: refs/heads/master@{#560430}
> > 
> > TBR=bashi@chromium.org,ssid@chromium.org
> > 
> > Change-Id: I4b50e522dcc6c91542927a9e769e5eee24f486a5
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: 843419
> > Reviewed-on: https://chromium-review.googlesource.com/1069567
> > Reviewed-by: enne <enne@chromium.org>
> > Commit-Queue: enne <enne@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#560761}
> 
> TBR=bashi@chromium.org,enne@chromium.org,ssid@chromium.org
> 
> Change-Id: I4d0a08cd44772dc690ac1d93b1d92b4934ed0373
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 845411, 843419
> Reviewed-on: https://chromium-review.googlesource.com/1069888
> Reviewed-by: Siddhartha S <ssid@chromium.org>
> Commit-Queue: Siddhartha S <ssid@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#560882}

TBR=bashi@chromium.org,enne@chromium.org,ssid@chromium.org

Change-Id: Ib8841dddaa2a167e674c997ec1577036df26e8cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 845411, 843419
Reviewed-on: https://chromium-review.googlesource.com/1069876Reviewed-by: default avatarSiddhartha S <ssid@chromium.org>
Commit-Queue: Siddhartha S <ssid@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560889}
parent 2f65eec4
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/strings/string_number_conversions.h"
#include "base/sys_info.h" #include "base/sys_info.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
...@@ -16,10 +15,6 @@ namespace { ...@@ -16,10 +15,6 @@ namespace {
const char kSwapFreeThresholdRatioParamName[] = "swap_free_threshold_ratio"; const char kSwapFreeThresholdRatioParamName[] = "swap_free_threshold_ratio";
const char kUseComponentCallbacks[] = "use_component_callbacks"; const char kUseComponentCallbacks[] = "use_component_callbacks";
const char kRendererWorkloadThresholdDeprecated[] =
"renderer_workload_threshold";
const char kRendererWorkloadThresholdPercentage[] =
"renderer_workload_threshold_percentage";
// Default SwapFree/SwapTotal ratio for detecting near-OOM situation. // Default SwapFree/SwapTotal ratio for detecting near-OOM situation.
// TODO(bashi): Confirm that this is appropriate. // TODO(bashi): Confirm that this is appropriate.
...@@ -33,36 +28,14 @@ constexpr base::TimeDelta kDefaultMonitoringDelta = ...@@ -33,36 +28,14 @@ constexpr base::TimeDelta kDefaultMonitoringDelta =
constexpr base::TimeDelta kDefaultCooldownDelta = constexpr base::TimeDelta kDefaultCooldownDelta =
base::TimeDelta::FromSeconds(30); base::TimeDelta::FromSeconds(30);
uint64_t GetRendererMemoryWorkloadThreshold() {
// Approximately 80MB for 512MB devices.
const uint64_t kDefaultMemoryWorkloadThresholdPercent = 16;
std::string threshold_str = base::GetFieldTrialParamValueByFeature(
features::kOomIntervention, kRendererWorkloadThresholdPercentage);
uint64_t threshold = 0;
size_t ram_size = base::SysInfo::AmountOfPhysicalMemory();
if (base::StringToUint64(threshold_str, &threshold)) {
return threshold * ram_size / 100;
}
// If the old trigger param is set, then enable intervention only on 512MB
// devices.
threshold_str = base::GetFieldTrialParamValueByFeature(
features::kOomIntervention, kRendererWorkloadThresholdDeprecated);
if (base::StringToUint64(threshold_str, &threshold)) {
if (ram_size > 512 * 1024 * 1024)
return 0;
return threshold;
}
return kDefaultMemoryWorkloadThresholdPercent * ram_size / 100;
}
} // namespace } // namespace
// static // static
NearOomMonitor* NearOomMonitor::Create() { NearOomMonitor* NearOomMonitor::Create() {
if (!base::FeatureList::IsEnabled(features::kOomIntervention)) if (!base::FeatureList::IsEnabled(features::kOomIntervention))
return nullptr; return nullptr;
if (!base::SysInfo::IsLowEndDevice())
return nullptr;
base::SystemMemoryInfoKB memory_info; base::SystemMemoryInfoKB memory_info;
if (!base::GetSystemMemoryInfo(&memory_info)) if (!base::GetSystemMemoryInfo(&memory_info))
...@@ -78,12 +51,8 @@ NearOomMonitor* NearOomMonitor::Create() { ...@@ -78,12 +51,8 @@ NearOomMonitor* NearOomMonitor::Create() {
kDefaultSwapFreeThresholdRatio); kDefaultSwapFreeThresholdRatio);
int64_t swapfree_threshold = int64_t swapfree_threshold =
static_cast<int64_t>(memory_info.swap_total * threshold_ratio); static_cast<int64_t>(memory_info.swap_total * threshold_ratio);
uint64_t renderer_workload_threshold = GetRendererMemoryWorkloadThreshold();
if (!renderer_workload_threshold)
return nullptr;
return new NearOomMonitor(base::ThreadTaskRunnerHandle::Get(), return new NearOomMonitor(base::ThreadTaskRunnerHandle::Get(),
swapfree_threshold, renderer_workload_threshold); swapfree_threshold);
} }
// static // static
...@@ -94,15 +63,13 @@ NearOomMonitor* NearOomMonitor::GetInstance() { ...@@ -94,15 +63,13 @@ NearOomMonitor* NearOomMonitor::GetInstance() {
NearOomMonitor::NearOomMonitor( NearOomMonitor::NearOomMonitor(
scoped_refptr<base::SequencedTaskRunner> task_runner, scoped_refptr<base::SequencedTaskRunner> task_runner,
int64_t swapfree_threshold, int64_t swapfree_threshold)
uint64_t renderer_workload_threshold)
: task_runner_(task_runner), : task_runner_(task_runner),
check_callback_( check_callback_(
base::Bind(&NearOomMonitor::Check, base::Unretained(this))), base::Bind(&NearOomMonitor::Check, base::Unretained(this))),
monitoring_interval_(kDefaultMonitoringDelta), monitoring_interval_(kDefaultMonitoringDelta),
cooldown_interval_(kDefaultCooldownDelta), cooldown_interval_(kDefaultCooldownDelta),
swapfree_threshold_(swapfree_threshold), swapfree_threshold_(swapfree_threshold),
renderer_workload_threshold_(renderer_workload_threshold),
component_callback_is_enabled_( component_callback_is_enabled_(
base::GetFieldTrialParamByFeatureAsBool(features::kOomIntervention, base::GetFieldTrialParamByFeatureAsBool(features::kOomIntervention,
kUseComponentCallbacks, kUseComponentCallbacks,
......
...@@ -39,16 +39,11 @@ class NearOomMonitor { ...@@ -39,16 +39,11 @@ class NearOomMonitor {
void OnLowMemory(JNIEnv* env, void OnLowMemory(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jcaller); const base::android::JavaParamRef<jobject>& jcaller);
uint64_t renderer_workload_threshold() const {
return renderer_workload_threshold_;
}
protected: protected:
static NearOomMonitor* Create(); static NearOomMonitor* Create();
NearOomMonitor(scoped_refptr<base::SequencedTaskRunner> task_runner, NearOomMonitor(scoped_refptr<base::SequencedTaskRunner> task_runner,
int64_t swapfree_threshold, int64_t swapfree_threshold);
uint64_t renderer_workload_threshold);
// Gets system memory info. This is a virtual method so that we can override // Gets system memory info. This is a virtual method so that we can override
// this for testing. // this for testing.
...@@ -77,7 +72,6 @@ class NearOomMonitor { ...@@ -77,7 +72,6 @@ class NearOomMonitor {
base::TimeTicks next_check_time_; base::TimeTicks next_check_time_;
int64_t swapfree_threshold_; int64_t swapfree_threshold_;
uint64_t renderer_workload_threshold_;
CallbackList callbacks_; CallbackList callbacks_;
......
...@@ -12,16 +12,13 @@ ...@@ -12,16 +12,13 @@
namespace { namespace {
const int64_t kTestSwapTotalKB = 128 * 1024; const int64_t kTestSwapTotalKB = 128 * 1024;
const int64_t kTestSwapFreeThreshold = kTestSwapTotalKB / 4; const int64_t kTestSwapFreeThreshold = kTestSwapTotalKB / 4;
const uint64_t kRendererWorkloadThreshold = 10 * 1024;
} // namespace } // namespace
class MockNearOomMonitor : public NearOomMonitor { class MockNearOomMonitor : public NearOomMonitor {
public: public:
explicit MockNearOomMonitor( explicit MockNearOomMonitor(
scoped_refptr<base::SequencedTaskRunner> task_runner) scoped_refptr<base::SequencedTaskRunner> task_runner)
: NearOomMonitor(task_runner, : NearOomMonitor(task_runner, kTestSwapFreeThreshold) {
kTestSwapFreeThreshold,
kRendererWorkloadThreshold) {
// Start with 128MB swap total and 64MB swap free. // Start with 128MB swap total and 64MB swap free.
memory_info_.swap_total = kTestSwapTotalKB; memory_info_.swap_total = kTestSwapTotalKB;
memory_info_.swap_free = kTestSwapTotalKB / 2; memory_info_.swap_free = kTestSwapTotalKB / 2;
......
...@@ -61,6 +61,7 @@ void RecordInterventionStateOnCrash(bool accepted) { ...@@ -61,6 +61,7 @@ void RecordInterventionStateOnCrash(bool accepted) {
// Field trial parameter names. // Field trial parameter names.
const char kRendererPauseParamName[] = "pause_renderer"; const char kRendererPauseParamName[] = "pause_renderer";
const char kShouldDetectInRenderer[] = "detect_in_renderer"; const char kShouldDetectInRenderer[] = "detect_in_renderer";
const char kRendererWorkloadThreshold[] = "renderer_workload_threshold";
bool RendererPauseIsEnabled() { bool RendererPauseIsEnabled() {
static bool enabled = base::GetFieldTrialParamByFeatureAsBool( static bool enabled = base::GetFieldTrialParamByFeatureAsBool(
...@@ -74,6 +75,18 @@ bool ShouldDetectInRenderer() { ...@@ -74,6 +75,18 @@ bool ShouldDetectInRenderer() {
return enabled; return enabled;
} }
uint64_t GetRendererMemoryWorkloadThreshold() {
const uint64_t kDefaultMemoryWorkloadThreshold = 80 * 1024 * 1024;
std::string threshold_str = base::GetFieldTrialParamValueByFeature(
features::kOomIntervention, kRendererWorkloadThreshold);
uint64_t threshold = 0;
if (!base::StringToUint64(threshold_str, &threshold)) {
return kDefaultMemoryWorkloadThreshold;
}
return threshold;
}
} // namespace } // namespace
// static // static
...@@ -87,8 +100,7 @@ OomInterventionTabHelper::OomInterventionTabHelper( ...@@ -87,8 +100,7 @@ OomInterventionTabHelper::OomInterventionTabHelper(
decider_(OomInterventionDecider::GetForBrowserContext( decider_(OomInterventionDecider::GetForBrowserContext(
web_contents->GetBrowserContext())), web_contents->GetBrowserContext())),
binding_(this), binding_(this),
renderer_memory_workload_threshold_( renderer_memory_workload_threshold_(GetRendererMemoryWorkloadThreshold()),
NearOomMonitor::GetInstance()->renderer_workload_threshold()),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
OutOfMemoryReporter::FromWebContents(web_contents)->AddObserver(this); OutOfMemoryReporter::FromWebContents(web_contents)->AddObserver(this);
shared_metrics_buffer_ = base::UnsafeSharedMemoryRegion::Create( shared_metrics_buffer_ = base::UnsafeSharedMemoryRegion::Create(
......
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