Commit 6d6c8e11 authored by Kuo-Hsin Yang's avatar Kuo-Hsin Yang Committed by Commit Bot

chromeos: Update the swap configuration after ARC launch

When ARC is launched, the min filelist configuration may be changed,
notify the change to the memory component.

BUG=1014871
TEST=check the swap configuration after ARC launch.

Change-Id: Ib7d074c4183ff3e7323eb582bf0c8706ec612d10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2141488Reviewed-by: default avatarBrian Geffon <bgeffon@chromium.org>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Commit-Queue: Kuo-Hsin Yang <vovoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757739}
parent 83e1d0ea
......@@ -42,6 +42,7 @@ component("chromeos") {
":chromeos_export",
"//base",
"//base:i18n",
"//base/util/memory_pressure",
"//chromeos/dbus",
"//chromeos/dbus/constants",
"//components/policy/proto",
......
......@@ -8,6 +8,8 @@
#include <sys/mman.h>
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/util/memory_pressure/system_memory_pressure_evaluator_chromeos.h"
#include "chromeos/memory/swap_configuration.h"
namespace chromeos {
......@@ -83,4 +85,12 @@ CHROMEOS_EXPORT void LockMainProgramText() {
}
}
CHROMEOS_EXPORT void UpdateMemoryParameters() {
auto* monitor = util::chromeos::SystemMemoryPressureEvaluator::Get();
if (monitor)
monitor->UpdateMemoryParameters();
ConfigureSwap();
}
} // namespace chromeos
......@@ -30,6 +30,9 @@ extern const base::FeatureParam<int> kCrOSLockMainProgramTextMaxSize;
// Lock main program text segments fully.
CHROMEOS_EXPORT void LockMainProgramText();
// It should be called when some memory configuration is changed.
CHROMEOS_EXPORT void UpdateMemoryParameters();
} // namespace chromeos
#endif // CHROMEOS_MEMORY_MEMORY_H_
......@@ -231,7 +231,7 @@ static_library("arc_base") {
deps = [
"//ash/public/cpp",
"//base",
"//base/util/memory_pressure",
"//chromeos",
"//chromeos/constants",
"//chromeos/cryptohome",
"//chromeos/dbus:common",
......
......@@ -3,6 +3,7 @@ include_rules = [
"+chromeos/constants",
"+chromeos/cryptohome",
"+chromeos/dbus",
"+chromeos/memory",
"+chromeos/system",
"+components/guest_os",
"+components/account_id",
......
......@@ -26,9 +26,9 @@
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/util/memory_pressure/system_memory_pressure_evaluator_chromeos.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
#include "chromeos/memory/memory.h"
#include "chromeos/system/scheduler_configuration_manager_base.h"
#include "components/arc/arc_features.h"
#include "components/arc/arc_util.h"
......@@ -575,11 +575,8 @@ void ArcSessionImpl::OnMojoConnected(
VLOG(0) << "ARC ready.";
state_ = State::RUNNING_FULL_INSTANCE;
// Some memory parameters may be changed when ARC is launched, notify the
// memory monitor to update these parameters.
auto* monitor = util::chromeos::SystemMemoryPressureEvaluator::Get();
if (monitor)
monitor->UpdateMemoryParameters();
// Some memory parameters may be changed when ARC is launched.
chromeos::UpdateMemoryParameters();
}
void ArcSessionImpl::Stop() {
......
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