qqvpp commented on code in PR #8726:
URL: https://github.com/apache/hadoop/pull/8726#discussion_r4147651929


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/CGroupsV2ResourceCalculator.java:
##########
@@ -110,11 +110,24 @@ public CGroupsV2ResourceCalculator(String pid) {
     super(
         pid,
         Collections.singletonList(CPU_STAT),
-        MEM_STAT,
-        MEMSW_STAT
+        MEM_STAT
     );
   }
 
+  @Override
+  protected long calculateVirtualMemory() {
+    // Unlike cgroup v1, cgroup v2 does not expose a combined memory+swap
+    // counter. The virtual memory has to be derived by adding the swap usage
+    // (memory.swap.current) to the resident anonymous memory
+    // (memory.stat#anon).
+    long anon = getStat(MEM_STAT);

Review Comment:
   Thank you for pointing this out. You are right — memory.current should 
exactly match the way it is accounted for in cgroup v1. I’ve updated the 
implementation accordingly, and instead of memory.stat#anon, it now uses 
memory.current.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to