Forráskód Böngészése

YARN-600. Hook up cgroups CPU settings to the number of virtual cores allocated. (sandyr via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1492366 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 12 éve
szülő
commit
46e514b06b

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -295,6 +295,9 @@ Release 2.1.0-beta - UNRELEASED
     YARN-731. RPCUtil.unwrapAndThrowException should unwrap remote
     RuntimeExceptions. (Zhijie Shen via sseth)
 
+    YARN-600. Hook up cgroups CPU settings to the number of virtual cores 
+    allocated. (sandyr via tucu)
+
   OPTIMIZATIONS
 
     YARN-512. Log aggregation root directory check is more expensive than it

+ 2 - 5
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/util/CgroupsLCEResourcesHandler.java

@@ -172,18 +172,15 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
    * Next three functions operate on all the resources we are enforcing.
    */
 
-  /*
-   * TODO: After YARN-2 is committed, we should call containerResource.getCpus()
-   * (or equivalent) to multiply the weight by the number of requested cpus.
-   */
   private void setupLimits(ContainerId containerId,
                            Resource containerResource) throws IOException {
     String containerName = containerId.toString();
 
     if (isCpuWeightEnabled()) {
       createCgroup(CONTROLLER_CPU, containerName);
+      int cpuShares = CPU_DEFAULT_WEIGHT * containerResource.getVirtualCores();
       updateCgroup(CONTROLLER_CPU, containerName, "shares",
-          String.valueOf(CPU_DEFAULT_WEIGHT));
+          String.valueOf(cpuShares));
     }
   }