vm_tools: provide balloon_bias_mib arg to ARCVM

Pass `--balloon_bias_mib 48` argument to crosvm when starting ARCVM.
This value was determined by running the multivm.Lifecycle.arc_host and
multivm.LifecycleShifting.arc_host tests. Both tests consistently passed
with 32 and 64, but 48 provides a better balance between tabs_live and
apps_alive in multivm.Lifecycle.arc_host, meaning it is more fair.

Tests run on a hatch kled with 4/8G of memory.

BUG=b:172870597
TEST=tast run dut multivm.Lifecycle.arc_host
multivm.LifecycleShifting.arc_host

Cq-Depend: chromium:2596293
Change-Id: I55e988b9731209ea85ca0c0ebb88d33d01c2dbd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2596663
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: Charles Dueck <cwd@chromium.org>
Commit-Queue: Charles Dueck <cwd@chromium.org>
diff --git a/vm_tools/concierge/arc_vm.cc b/vm_tools/concierge/arc_vm.cc
index 7816729..bd0476d 100644
--- a/vm_tools/concierge/arc_vm.cc
+++ b/vm_tools/concierge/arc_vm.cc
@@ -201,7 +201,10 @@
   std::string shared_testharness = CreateSharedDataParam(
       testharness_dir, kTestHarnessSharedDirTag, true, false);
 
-  vm_builder.SetMemory(GetVmMemoryMiB())
+  vm_builder
+      .SetMemory(GetVmMemoryMiB())
+      // Bias tuned on 4/8G hatch devices with multivm.Lifecycle tests.
+      .SetBalloonBias("48")
       .SetVsockCid(vsock_cid_)
       .SetSocketPath(GetVmSocketPath())
       .AppendWaylandSocket(kWaylandSocket)
diff --git a/vm_tools/concierge/vm_builder.cc b/vm_tools/concierge/vm_builder.cc
index 50e5c4d7..424f31e 100644
--- a/vm_tools/concierge/vm_builder.cc
+++ b/vm_tools/concierge/vm_builder.cc
@@ -54,6 +54,11 @@
   return *this;
 }
 
+VmBuilder& VmBuilder::SetBalloonBias(const std::string& balloon_bias_mib) {
+  balloon_bias_mib_ = balloon_bias_mib;
+  return *this;
+}
+
 VmBuilder& VmBuilder::SetSyslogTag(const std::string& syslog_tag) {
   syslog_tag_ = syslog_tag;
   return *this;
@@ -149,6 +154,9 @@
   if (!memory_in_mib_.empty())
     args.emplace_back("--mem", memory_in_mib_);
 
+  if (!balloon_bias_mib_.empty())
+    args.emplace_back("--balloon_bias_mib", balloon_bias_mib_);
+
   for (const auto& tap_fd : tap_fds_)
     args.emplace_back("--tap-fd", std::to_string(tap_fd.get()));
 
diff --git a/vm_tools/concierge/vm_builder.h b/vm_tools/concierge/vm_builder.h
index 345ca06..dcf1a81 100644
--- a/vm_tools/concierge/vm_builder.h
+++ b/vm_tools/concierge/vm_builder.h
@@ -42,6 +42,7 @@
   VmBuilder& SetVsockCid(uint32_t vsock_cid);
   VmBuilder& AppendDisks(std::vector<Disk> disks);
   VmBuilder& SetMemory(const std::string& memory_in_mb);
+  VmBuilder& SetBalloonBias(const std::string& balloon_bias_mib);
 
   VmBuilder& SetSyslogTag(const std::string& syslog_tag);
   VmBuilder& SetSocketPath(const std::string& socket_path);
@@ -73,6 +74,7 @@
   int32_t cpus_ = 0;
   base::Optional<uint32_t> vsock_cid_;
   std::string memory_in_mib_;
+  std::string balloon_bias_mib_;
 
   std::string syslog_tag_;
   std::string vm_socket_path_;