This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 15959a137 [cgroups2] adjust CPU weight values from v1 to v2 default
15959a137 is described below

commit 15959a137d45a008c63bfd196a119efacbde57f3
Author: None <None>
AuthorDate: Wed May 15 17:43:44 2024 -0400

    [cgroups2] adjust CPU weight values from v1 to v2 default
    
    Modifies the cgroups CPU weights to reflect change
    from cpu.shares to cpu.weight.
    
    In v1, cgroups used cpu.shares which has a default of 1024.
    In v2, cgroups use cpu.weight which has a default of 100
    
    The range for the cpu.weight is [1,10000], the minimum
    weight has been updated to reflect this.
    
    The revocable CPU weight has been scaled down from 10 to 1
    to reflect a similar scale to the default.
    
    Review: https://reviews.apache.org/r/74992/
---
 src/slave/containerizer/mesos/isolators/cgroups2/constants.hpp      | 6 +++---
 .../containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp      | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/slave/containerizer/mesos/isolators/cgroups2/constants.hpp 
b/src/slave/containerizer/mesos/isolators/cgroups2/constants.hpp
index 9498a4779..b82f8cd74 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups2/constants.hpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups2/constants.hpp
@@ -26,9 +26,9 @@ namespace internal {
 namespace slave {
 
 // CPU controller constants.
-const uint64_t CPU_SHARES_PER_CPU = 1024;
-const uint64_t CPU_SHARES_PER_CPU_REVOCABLE = 10;
-const uint64_t MIN_CPU_SHARES = 2; // Linux constant.
+const uint64_t CPU_WEIGHT_PER_CPU = 100;
+const uint64_t CPU_WEIGHT_PER_CPU_REVOCABLE = 1;
+const uint64_t MIN_CPU_WEIGHT = 1; // Linux constant.
 const Duration CPU_CFS_PERIOD = Milliseconds(100); // Linux default.
 const Duration MIN_CPU_CFS_QUOTA = Milliseconds(1);
 
diff --git 
a/src/slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp 
b/src/slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp
index 85fe063a7..adebab744 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp
@@ -79,9 +79,9 @@ Future<Nothing> CpuControllerProcess::update(
   double cpuRequest = *resourceRequests.cpus();
   bool revocable = resourceRequests.revocable().cpus().isSome();
   uint64_t weightPerCpu = (revocable && flags.revocable_cpu_low_priority) ?
-      CPU_SHARES_PER_CPU_REVOCABLE : CPU_SHARES_PER_CPU;
+      CPU_WEIGHT_PER_CPU_REVOCABLE : CPU_WEIGHT_PER_CPU;
   uint64_t weight = std::max(
-      static_cast<uint64_t>(weightPerCpu * cpuRequest), MIN_CPU_SHARES);
+      static_cast<uint64_t>(weightPerCpu * cpuRequest), MIN_CPU_WEIGHT);
 
   Try<Nothing> update = cgroups2::cpu::weight(cgroup, weight);
   if (update.isError()) {

Reply via email to