Skip to content

Commit

Permalink
arcvm: Remove BalloonPolicy Feature
Browse files Browse the repository at this point in the history
The LimitCacheBalloonPolicy has been fully launched for some time
now and the feature plumbing is no longer needed.

Bug: b/254164308
Test: CQ, tast run DUT arc.Boot.vm

Change-Id: I78f4965028b0e383322810c9831b1ded583b636e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3955023
Reviewed-by: Yury Khmel <khmel@chromium.org>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1076615}
  • Loading branch information
kalutes authored and Chromium LUCI CQ committed Nov 29, 2022
1 parent cc19112 commit 5d5827f
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 151 deletions.
53 changes: 0 additions & 53 deletions ash/components/arc/arc_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -304,41 +304,6 @@ const base::FeatureParam<int> kVmMemorySizeShiftMiB{&kVmMemorySize, "shift_mib",
const base::FeatureParam<int> kVmMemorySizeMaxMiB{&kVmMemorySize, "max_mib",
INT32_MAX};

// Controls whether to use the new limit cache balloon policy. If disabled the
// old balance available balloon policy is used. If enabled, ChromeOS's Resource
// Manager (resourced) is able to kill ARCVM apps by sending a memory pressure
// signal.
// The limit cache balloon policy inflates the balloon to limit the kernel page
// cache inside ARCVM if memory in the host is low. See FeatureParams below for
// the conditions that limit cache. See mOomMinFreeHigh and mOomAdj in
// frameworks/base/services/core/java/com/android/server/am/ProcessList.java
// to see how LMKD maps kernel page cache to a priority level of app to kill.
// To ensure fairness between tab manager discards and ARCVM low memory kills,
// we want to stop LMKD killing things out of turn. We do this by making sure
// ARCVM never has it's kernel page cache drop below the level that LMKD will
// start killing.
BASE_FEATURE(kVmBalloonPolicy,
"ArcVmBalloonPolicy",
base::FEATURE_ENABLED_BY_DEFAULT);

// The maximum amount of kernel page cache ARCVM can have when ChromeOS is under
// moderate memory pressure. 0 for no limit.
const base::FeatureParam<int> kVmBalloonPolicyModerateKiB{&kVmBalloonPolicy,
"moderate_kib", 0};

// The maximum amount of kernel page cache ARCVM can have when ChromeOS is under
// critical memory pressure. 0 for no limit. The default value of 322560KiB
// corresponds to the level LMKD will start to kill the lowest priority cached
// app.
const base::FeatureParam<int> kVmBalloonPolicyCriticalKiB{
&kVmBalloonPolicy, "critical_kib", 322560};

// The maximum amount of kernel page cache ARCVM can have when ChromeOS is
// reclaiming. 0 for no limit. The default value of 322560KiB corresponds to the
// level LMKD will start to kill the lowest priority cached app.
const base::FeatureParam<int> kVmBalloonPolicyReclaimKiB{&kVmBalloonPolicy,
"reclaim_kib", 322560};

// Controls experimental key GMS Core and related services protection against to
// be killed by low memory killer in ARCVM.
BASE_FEATURE(kVmGmsCoreLowMemoryKillerProtection,
Expand All @@ -351,22 +316,4 @@ BASE_FEATURE(kVmBroadcastPreNotifyANR,
"ArcVmBroadcastPreAnrHandling",
base::FEATURE_DISABLED_BY_DEFAULT);

// If set, enable responsive balloon sizing. Concierge will listen on a VSOCK
// for connections from LMKD in Android. When LMKD is about to kill an App, it
// will signal the balloon sizing code, which may deflate the balloon instead
// of killing the app.
const base::FeatureParam<bool> kVmBalloonPolicyResponsive{&kVmBalloonPolicy,
"responsive", true};

// The amount of time LMKD will wait for a response from concierge before
// killing an app.
const base::FeatureParam<int> kVmBalloonPolicyResponsiveTimeoutMs{
&kVmBalloonPolicy, "responsive_timeout_ms", 100};

// If an app should not be killed, the balloon will be deflated by
// min(app_size, responsive_max_deflate_bytes), so that large apps don't
// completely deflate the balloon.
const base::FeatureParam<int> kVmBalloonPolicyResponsiveMaxDeflateBytes{
&kVmBalloonPolicy, "responsive_max_deflate_bytes", 256 * 1024 * 1024};

} // namespace arc
7 changes: 0 additions & 7 deletions ash/components/arc/arc_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,8 @@ extern const base::FeatureParam<int> kVmMemoryPSIReportsPeriod;
BASE_DECLARE_FEATURE(kVmMemorySize);
extern const base::FeatureParam<int> kVmMemorySizeShiftMiB;
extern const base::FeatureParam<int> kVmMemorySizeMaxMiB;
BASE_DECLARE_FEATURE(kVmBalloonPolicy);
extern const base::FeatureParam<int> kVmBalloonPolicyModerateKiB;
extern const base::FeatureParam<int> kVmBalloonPolicyCriticalKiB;
extern const base::FeatureParam<int> kVmBalloonPolicyReclaimKiB;
BASE_DECLARE_FEATURE(kVmBroadcastPreNotifyANR);
BASE_DECLARE_FEATURE(kVmGmsCoreLowMemoryKillerProtection);
extern const base::FeatureParam<bool> kVmBalloonPolicyResponsive;
extern const base::FeatureParam<int> kVmBalloonPolicyResponsiveTimeoutMs;
extern const base::FeatureParam<int> kVmBalloonPolicyResponsiveMaxDeflateBytes;

} // namespace arc

Expand Down
22 changes: 0 additions & 22 deletions ash/components/arc/session/arc_vm_client_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,28 +367,6 @@ vm_tools::concierge::StartArcVmRequest CreateStartArcVmRequest(
VLOG(1) << "VmMemorySize is disabled.";
}

// Specify balloon policy.
if (base::FeatureList::IsEnabled(kVmBalloonPolicy)) {
vm_tools::concierge::BalloonPolicyOptions* balloon_policy =
request.mutable_balloon_policy();
const int64_t moderate_kib = kVmBalloonPolicyModerateKiB.Get();
const int64_t critical_kib = kVmBalloonPolicyCriticalKiB.Get();
const int64_t reclaim_kib = kVmBalloonPolicyReclaimKiB.Get();
balloon_policy->set_moderate_target_cache(moderate_kib * 1024);
balloon_policy->set_critical_target_cache(critical_kib * 1024);
balloon_policy->set_reclaim_target_cache(reclaim_kib * 1024);
balloon_policy->set_responsive(kVmBalloonPolicyResponsive.Get());
balloon_policy->set_responsive_timeout_ms(
kVmBalloonPolicyResponsiveTimeoutMs.Get());
balloon_policy->set_responsive_max_deflate_bytes(
kVmBalloonPolicyResponsiveMaxDeflateBytes.Get());
VLOG(1) << "Use LimitCacheBalloonPolicy. ModerateKiB=" << moderate_kib
<< ", CriticalKiB=" << critical_kib
<< ", ReclaimKiB=" << reclaim_kib;
} else {
VLOG(1) << "Use BalanceAvailableBalloonPolicy";
}

AppendParamsFromStartParams(request, start_params);

auto* mini_instance_request = request.mutable_mini_instance_request();
Expand Down
30 changes: 0 additions & 30 deletions ash/components/arc/session/arc_vm_client_adapter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2153,36 +2153,6 @@ TEST_F(ArcVmClientAdapterTest, ArcVmMemorySizeEnabledOn32Bit) {
EXPECT_EQ(request.memory_mib(), k32bitVmRamMaxMib);
}

// Test that the correct BalloonPolicyOptions are set on StartArcVmRequest when
// kVmBalloonPolicy is enabled.
TEST_F(ArcVmClientAdapterTest, ArcVmBalloonPolicyEnabled) {
base::test::ScopedFeatureList feature_list;
base::FieldTrialParams params;
params["moderate_kib"] = "1";
params["critical_kib"] = "2";
params["reclaim_kib"] = "3";
feature_list.InitAndEnableFeatureWithParameters(kVmBalloonPolicy, params);
StartParams start_params(GetPopulatedStartParams());
StartMiniArcWithParams(true, std::move(start_params));
const auto& request = GetTestConciergeClient()->start_arc_vm_request();
EXPECT_TRUE(request.has_balloon_policy());
const auto& policy = request.balloon_policy();
EXPECT_EQ(policy.moderate_target_cache(), 1024);
EXPECT_EQ(policy.critical_target_cache(), 2048);
EXPECT_EQ(policy.reclaim_target_cache(), 3072);
}

// Test that BalloonPolicyOptions are not set on StartArcVmRequest when
// kVmBalloonPolicy is disabled.
TEST_F(ArcVmClientAdapterTest, ArcVmBalloonPolicyDisabled) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndDisableFeature(kVmBalloonPolicy);
StartParams start_params(GetPopulatedStartParams());
StartMiniArcWithParams(true, std::move(start_params));
const auto& request = GetTestConciergeClient()->start_arc_vm_request();
EXPECT_FALSE(request.has_balloon_policy());
}

// Test that the request passes an empty disk for the demo image
// or the block apex composite disk when they are not present.
// There should be two empty disks (/dev/block/vdc and /dev/block/vdd)
Expand Down
10 changes: 0 additions & 10 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,6 @@ const char kLacrosWaylandLoggingInternalName[] = "lacros-wayland-logging";
const char kWebAppsCrosapiInternalName[] = "web-apps-crosapi";
const char kArcEnableVirtioBlkForDataInternalName[] =
"arc-enable-virtio-blk-for-data";
const char kArcVmBalloonPolicyInternalName[] =
"arc-use-limit-cache-balloon-policy";

const FeatureEntry::Choice kPreferDcheckChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""},
Expand Down Expand Up @@ -5038,10 +5036,6 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kArcUsbDeviceDefaultAttachToVmName,
flag_descriptions::kArcUsbDeviceDefaultAttachToVmDescription, kOsCrOS,
FEATURE_VALUE_TYPE(arc::kUsbDeviceDefaultAttachToArcVm)},
{kArcVmBalloonPolicyInternalName,
flag_descriptions::kArcVmBalloonPolicyName,
flag_descriptions::kArcVmBalloonPolicyDesc, kOsCrOS,
FEATURE_VALUE_TYPE(arc::kVmBalloonPolicy)},
{"enable-arc-host-vpn", flag_descriptions::kEnableArcHostVpnName,
flag_descriptions::kEnableArcHostVpnDescription, kOsCrOS,
FEATURE_VALUE_TYPE(arc::kEnableArcHostVpn)},
Expand Down Expand Up @@ -9624,10 +9618,6 @@ bool ShouldSkipConditionalFeatureEntry(const flags_ui::FlagsStorage* storage,
return !arc::IsArcVmEnabled();
}

if (!strcmp(kArcVmBalloonPolicyInternalName, entry.internal_name)) {
return !arc::IsArcVmEnabled();
}

// Only show Borealis flags on enabled devices.
if (!strcmp(kBorealisBigGlInternalName, entry.internal_name)) {
return !base::FeatureList::IsEnabled(features::kBorealis);
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ash/arc/session/arc_service_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ void ArcServiceLauncher::OnPrimaryUserProfilePrepared(Profile* profile) {

if (arc::IsArcVmEnabled()) {
// ARCVM-only services.
if (base::FeatureList::IsEnabled(kVmBalloonPolicy))
ArcMemoryPressureBridge::GetForBrowserContext(profile);
ArcMemoryPressureBridge::GetForBrowserContext(profile);
} else {
// ARC Container-only services.
ArcAppfuseBridge::GetForBrowserContext(profile);
Expand Down
6 changes: 0 additions & 6 deletions chrome/browser/flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4754,12 +4754,6 @@ const char kArcUsbDeviceDefaultAttachToVmName[] =
const char kArcUsbDeviceDefaultAttachToVmDescription[] =
"When ARCVM is enabled, always attach unclaimed USB devices to ARCVM";

const char kArcVmBalloonPolicyName[] =
"Enable ARCVM limit cache balloon policy";
const char kArcVmBalloonPolicyDesc[] =
"Trigger reclaim in ARCVM to reduce memory use when ChromeOS is running "
"low on memory.";

const char kArcEnableUsapName[] =
"Enable ARC Unspecialized Application Processes";
const char kArcEnableUsapDesc[] =
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/flag_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -2735,9 +2735,6 @@ extern const char kArcUpdateO4CListViaA2C2Desc[];
extern const char kArcUsbDeviceDefaultAttachToVmName[];
extern const char kArcUsbDeviceDefaultAttachToVmDescription[];

extern const char kArcVmBalloonPolicyName[];
extern const char kArcVmBalloonPolicyDesc[];

extern const char kArcEnableUsapName[];
extern const char kArcEnableUsapDesc[];

Expand Down
18 changes: 0 additions & 18 deletions testing/variations/fieldtrial_testing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -692,24 +692,6 @@
]
}
],
"ArcVmLimitCacheBalloonPolicy": [
{
"platforms": [
"chromeos"
],
"experiments": [
{
"name": "ResponsiveBalloonDeflation_20220706",
"params": {
"responsive": "true"
},
"enable_features": [
"ArcVmBalloonPolicy"
]
}
]
}
],
"ArcVmMemorySize": [
{
"platforms": [
Expand Down

0 comments on commit 5d5827f

Please sign in to comment.