8292541: [Metrics] Reported memory limit may exceed physical machine memory

Reviewed-by: stuefe, sgehwolf
This commit is contained in:
Jonathan Dowland 2022-08-26 16:22:14 +00:00 committed by Severin Gehwolf
parent c74b6d4552
commit 9a0d1e7ce8
3 changed files with 52 additions and 16 deletions

View file

@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <unistd.h>
#include "jni.h"
#include "jvm.h"
@ -33,3 +34,10 @@ Java_jdk_internal_platform_CgroupMetrics_isUseContainerSupport(JNIEnv *env, jcla
{
return JVM_IsUseContainerSupport();
}
JNIEXPORT jlong JNICALL
Java_jdk_internal_platform_CgroupMetrics_getTotalMemorySize0
(JNIEnv *env, jclass ignored)
{
return sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE);
}