Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8246648: issue with OperatingSystemImpl getFreeSwapSpaceSize in docke…
…r after 8242480

Reviewed-by: bobv, sgehwolf
  • Loading branch information
MBaesken committed Jun 8, 2020
1 parent a98bad2 commit 7d6c1cf4a88b7e284ace10cb79e7f136dd6dc576
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java
@@ -72,13 +72,13 @@ public long getFreeSwapSpaceSize() {
if (containerMetrics != null) {
long memSwapLimit = containerMetrics.getMemoryAndSwapLimit();
long memLimit = containerMetrics.getMemoryLimit();
long deltaLimit = memSwapLimit - memLimit;
// Return 0 when memSwapLimit == memLimit, which means no swap space is allowed.
// And the same for memSwapLimit < memLimit.
if (deltaLimit <= 0) {
return 0;
}
if (memSwapLimit >= 0 && memLimit >= 0) {
long deltaLimit = memSwapLimit - memLimit;
// Return 0 when memSwapLimit == memLimit, which means no swap space is allowed.
// And the same for memSwapLimit < memLimit.
if (deltaLimit <= 0) {
return 0;
}
for (int attempt = 0; attempt < MAX_ATTEMPTS_NUMBER; attempt++) {
long memSwapUsage = containerMetrics.getMemoryAndSwapUsage();
long memUsage = containerMetrics.getMemoryUsage();

0 comments on commit 7d6c1cf

Please sign in to comment.