RFR: 8299858: [Metrics] Swap memory limit reported incorrectly when too large [v3]
Severin Gehwolf
sgehwolf at openjdk.org
Wed Jan 25 13:25:07 UTC 2023
On Wed, 25 Jan 2023 13:05:06 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>>
>> 8299858: [Metrics] Swap memory limit reported incorrectly when too large
>
> src/java.base/linux/native/libjava/CgroupMetrics.c line 45:
>
>> 43: jlong pages = sysconf(_SC_PHYS_PAGES);
>> 44: jlong page_size = sysconf(_SC_PAGESIZE);
>> 45: return pages * page_size;
>
> Preexisting, and theoretical nitpickery: I got curious when I saw this. What does sysconf return if a 32-bit VM runs on a large machine with >8Tb main memory and 4k pages? In that case, _SC_PHYS_PAGES would overflow the 32-bit long return type of sysconf.
Yes. Any suggestions as to how to fix it? This code was actually changed recently with [JDK-8300119](https://bugs.openjdk.org/browse/JDK-8300119). Anyway, this should go into a separate bug if we change it. Do you agree?
-------------
PR: https://git.openjdk.org/jdk/pull/12118
More information about the core-libs-dev
mailing list