RFR: 8299858: [Metrics] Swap memory limit reported incorrectly when too large [v3]
Thomas Stuefe
stuefe at openjdk.org
Wed Jan 25 14:02:13 UTC 2023
On Wed, 25 Jan 2023 13:22:45 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> 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?
I honestly have no idea of how to fix it. A separate RFE would be fine.
-------------
PR: https://git.openjdk.org/jdk/pull/12118
More information about the core-libs-dev
mailing list