RFR: 8292541: [Metrics] Reported memory limit may exceed physical machine memory [v6]
Jonathan Dowland
jdowland at openjdk.org
Fri Aug 26 14:06:18 UTC 2022
On Fri, 26 Aug 2022 13:32:35 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Jonathan Dowland has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:
>>
>> - Rework testContainerMemExceedsPhysical to use common hostMaxMem
>>
>> For 8292541, I wrote two further tests that used the same technique
>> as testContainerMemExceedsPhysical to establish baseline physical
>> RAM. Rework testContainerMemExceedsPhysical to use the shared
>> variable hostMaxMem rather than recalculate the value itself.
>> - Merge remote-tracking branch 'origin/master' into 8292541-cgroup-metrics
>> - Add a log-line for total physical memory
>>
>> This is relied upon for tests in
>> test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
>> - use pre-defined constant over magic number
>> - Address style nits
>> - Address nit
>>
>> Thanks Thomas Stuefe
>> - avoid calling subsystem.getMemoryLimit twice
>> - catch CgroupMetrics.getMemoryLimit exceeding physical RAM
>>
>> Detect when the subsystem limit exceeds physical RAM and treat
>> that situation as "unlimited".
>>
>> Add a private native method to establish physical RAM size.
>>
>> This presently is only likely to work on POSIX systems, but
>> CgroupMetrics are Linux-specific. None the less the precise guards etc.
>> may need adjusting.
>> - Add two tests to catch deriving invalid max memory limit from cgroups
>>
>> One test for OperatingSystemMXBean and another for
>> -XshowSettings:system, which exercises the Metrics sub-system.
>>
>> extend TestMemoryAwareness to cover OperatingSystemMXBean with bad cgroup memory limit
>>
>> add testMetricsIgnoresMemLimitExceedingPhysicalMemory and refactor
>>
>> Pull the code that establishes host physical max RAM out into a helper
>> function.
>
> test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java line 93:
>
>> 91: testOperatingSystemMXBeanIgnoresMemLimitExceedingPhysicalMemory();
>> 92: testMetricsIgnoresMemLimitExceedingPhysicalMemory();
>> 93: testContainerMemExceedsPhysical();
>
> Could we pass `hostMaxMem` to the relevant test functions as a parameter, instead of relying on a static variable magically being set, please? It would be a good symmetry to other tests.
Good idea! Implemented in 0f37be83ff0.
-------------
PR: https://git.openjdk.org/jdk/pull/10017
More information about the core-libs-dev
mailing list