Hexiaoqiao commented on code in PR #8726:
URL: https://github.com/apache/hadoop/pull/8726#discussion_r4092308885
##########
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);
+ long swap = getStat(MEMSW_STAT);
+ if (anon == UNAVAILABLE || swap == UNAVAILABLE) {
Review Comment:
Is it proper to change to `&&` for this condition?
--
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]