Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8247863

Unreachable code in OperatingSystemImpl.getTotalSwapSpaceSize()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 15, 16
    • core-svc
    • None
    • Docker

      During review of JDK-8244500 it was discovered that with the new cgroups implementation supporting v1 and v2 Metrics.getMemoryAndSwapLimit() will never return 0 when relevant cgroup files are missing. E.g. on a system where the kernel doesn't support swap limit capabilities. Therefore this code introduced with JDK-8236617 can no longer be reached and should get removed:

                   if (limit >= 0 && memLimit >= 0) {
      - return limit - memLimit;
      + // we see a limit == 0 on some machines where "kernel does not support swap limit capabilities"
      + return (limit < memLimit) ? 0 : limit - memLimit;
                   }

      More details here:
      http://mail.openjdk.java.net/pipermail/hotspot-dev/2020-June/042167.html

            sgehwolf Severin Gehwolf
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: