hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From templ...@apache.org
Subject hadoop git commit: YARN-7397. Reduce lock contention in FairScheduler#getAppWeight()
Date Sat, 28 Oct 2017 16:13:41 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 9c5c68745 -> e62bbbca7


YARN-7397. Reduce lock contention in FairScheduler#getAppWeight()


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e62bbbca
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e62bbbca
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e62bbbca

Branch: refs/heads/trunk
Commit: e62bbbca7adafa0e050212e99c41c95a844700ff
Parents: 9c5c687
Author: Daniel Templeton <templedf@apache.org>
Authored: Sat Oct 28 09:13:13 2017 -0700
Committer: Daniel Templeton <templedf@apache.org>
Committed: Sat Oct 28 09:13:13 2017 -0700

----------------------------------------------------------------------
 .../scheduler/fair/FairScheduler.java                | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e62bbbca/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java
index 0441859..8ea07ab 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java
@@ -369,17 +369,20 @@ public class FairScheduler extends
   }
 
   public float getAppWeight(FSAppAttempt app) {
-    try {
+    double weight = 1.0;
+
+    if (sizeBasedWeight) {
       readLock.lock();
-      double weight = 1.0;
-      if (sizeBasedWeight) {
+
+      try {
         // Set weight based on current memory demand
         weight = Math.log1p(app.getDemand().getMemorySize()) / Math.log(2);
+      } finally {
+        readLock.unlock();
       }
-      return (float)weight * app.getPriority().getPriority();
-    } finally {
-      readLock.unlock();
     }
+
+    return (float)weight * app.getPriority().getPriority();
   }
 
   public Resource getIncrementResourceCapability() {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message