RFR (8u): JDK-8146115: Improve docker container detection and resource configuration usage

Bob Vandette bob.vandette at oracle.com
Thu May 17 18:12:46 UTC 2018


The backport of my changes look pretty good.

If the new PrintContainerInfo option is only referenced on Linux platforms, you might
want to move it to globals_linux.hpp.

Is there a reason PrintActiveCpus is a diagnostic flag but PrintContainerInfo is not?

Is it acceptable to add these new VM flags in a backport that won’t be supported in the latest release?

Bob.


> On May 15, 2018, at 4:46 PM, Poonam Parhar <poonam.bajaj at oracle.com> wrote:
> 
> Hello,
> 
> Please review the docker container support changes backported to JDK 8u. These changes include the backport of the following enhancement and the follow-on bug fixes done on top of that in jdk 10 and 11.
> 
> Webrev: http://cr.openjdk.java.net/~poonam/8146115/webrev.00/
> 
> Enhancement:JDK-8146115: Improve docker container detection and resource configuration usage <https://bugs.openjdk.java.net/browse/JDK-8146115>
> 
> The changes also include the fixes for the following two bugs:
> Bug JDK-8186248: Allow more flexibility in selecting Heap % of available RAM <https://bugs.openjdk.java.net/browse/JDK-8186248><https://bugs.openjdk.java.net/browse/JDK-8190283>
> BugJDK-8190283: <https://bugs.openjdk.java.net/browse/JDK-8190283> Default heap sizing options select a MaxHeapSize larger than available physical memory in some cases <https://bugs.openjdk.java.net/browse/JDK-8190283>
> 
> These changes add a new JVM option 'PrintContainerInfo' for tracing container related information which is specific to jdk 8.
> 
> Testing results (with -XX:+UnlockDiagnosticVMOptions -XX:+PrintContainerInfo -XX:+PrintActiveCpus JVM options):
> --------------
> poonam at poonam-VirtualBox:~/docker-image$ java TestCPUsMemory
> Number of Processors: 3
> Max Memory: 921174016
> poonam at poonam-VirtualBox:~/docker-image$ sudo docker run --cpus 1 -m1024m  --rm myimage
> [sudo] password for poonam:
> WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
> OSContainer::init: Initializing Container Support
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: 100000
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> CPU Quota count based on quota/period: 1
> OSContainer::active_processor_count: 1
> active_processor_count: determined by OSContainer: 1
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: 100000
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> CPU Quota count based on quota/period: 1
> OSContainer::active_processor_count: 1
> active_processor_count: determined by OSContainer: 1
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> total container memory: 1073741824
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: 100000
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> CPU Quota count based on quota/period: 1
> OSContainer::active_processor_count: 1
> active_processor_count: determined by OSContainer: 1
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: 100000
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> CPU Quota count based on quota/period: 1
> OSContainer::active_processor_count: 1
> active_processor_count: determined by OSContainer: 1
> 
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: 100000
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> CPU Quota count based on quota/period: 1
> OSContainer::active_processor_count: 1
> active_processor_count: determined by OSContainer: 1
> Number of Processors: 1
> Max Memory: 259522560
> 
> poonam at poonam-VirtualBox:~/docker-image$ sudo docker run --cpu-shares 2048 -m1024m  --rm myimage
> WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
> OSContainer::init: Initializing Container Support
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 2048
> CPU Share count based on shares: 2
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 2048
> CPU Share count based on shares: 2
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> total container memory: 1073741824
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> total container memory: 1073741824
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 2048
> CPU Share count based on shares: 2
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 2048
> CPU Share count based on shares: 2
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> 
> active_processor_count: sched_getaffinity processor count: 3
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 2048
> CPU Share count based on shares: 2
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> Number of Processors: 2
> Max Memory: 259522560
> 
> poonam at poonam-VirtualBox:~/docker-image$ sudo docker run --cpuset-cpus 0-1 -m1024m  --rm myimage
> WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
> OSContainer::init: Initializing Container Support
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> active_processor_count: sched_getaffinity processor count: 2
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> active_processor_count: sched_getaffinity processor count: 2
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> total container memory: 1073741824
> Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> Memory Limit is: 1073741824
> total container memory: 1073741824
> active_processor_count: sched_getaffinity processor count: 2
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> active_processor_count: sched_getaffinity processor count: 2
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> 
> active_processor_count: sched_getaffinity processor count: 2
> Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
> CPU Quota is: -1
> Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
> CPU Period is: 100000
> Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
> CPU Shares is: 1024
> OSContainer::active_processor_count: 2
> active_processor_count: determined by OSContainer: 2
> Number of Processors: 2
> Max Memory: 259522560
> ------------------
> 
> Thanks,
> Poonam
> 



More information about the hotspot-dev mailing list