Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hotspot/src/os/linux/vm/cgroupSubsystem_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ class CgroupSubsystem: public CHeapObj<mtInternal> {
virtual jlong memory_and_swap_limit_in_bytes() = 0;
virtual jlong memory_soft_limit_in_bytes() = 0;
virtual jlong memory_max_usage_in_bytes() = 0;
virtual jlong rss_usage_in_bytes() = 0;
virtual jlong cache_usage_in_bytes() = 0;

virtual char * cpu_cpuset_cpus() = 0;
virtual char * cpu_cpuset_memory_nodes() = 0;
Expand Down
11 changes: 11 additions & 0 deletions hotspot/src/os/linux/vm/cgroupV1Subsystem_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ jlong CgroupV1Subsystem::memory_max_usage_in_bytes() {
return memmaxusage;
}

jlong CgroupV1Subsystem::rss_usage_in_bytes() {
GET_CONTAINER_INFO_LINE(julong, _memory->controller(), "/memory.stat",
"rss", JULONG_FORMAT, JULONG_FORMAT, rss);
return rss;
}

jlong CgroupV1Subsystem::cache_usage_in_bytes() {
GET_CONTAINER_INFO_LINE(julong, _memory->controller(), "/memory.stat",
"cache", JULONG_FORMAT, JULONG_FORMAT, cache);
return cache;
}

jlong CgroupV1Subsystem::kernel_memory_usage_in_bytes() {
GET_CONTAINER_INFO(jlong, _memory->controller(), "/memory.kmem.usage_in_bytes",
Expand Down
2 changes: 2 additions & 0 deletions hotspot/src/os/linux/vm/cgroupV1Subsystem_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class CgroupV1Subsystem: public CgroupSubsystem {
jlong memory_soft_limit_in_bytes();
jlong memory_usage_in_bytes();
jlong memory_max_usage_in_bytes();
jlong rss_usage_in_bytes();
jlong cache_usage_in_bytes();

jlong kernel_memory_usage_in_bytes();
jlong kernel_memory_limit_in_bytes();
Expand Down
12 changes: 12 additions & 0 deletions hotspot/src/os/linux/vm/cgroupV2Subsystem_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ jlong CgroupV2Subsystem::memory_max_usage_in_bytes() {
return OSCONTAINER_ERROR; // not supported
}

jlong CgroupV2Subsystem::rss_usage_in_bytes() {
GET_CONTAINER_INFO_LINE(julong, _memory->controller(), "/memory.stat",
"anon", JULONG_FORMAT, JULONG_FORMAT, rss);
return rss;
}

jlong CgroupV2Subsystem::cache_usage_in_bytes() {
GET_CONTAINER_INFO_LINE(julong, _memory->controller(), "/memory.stat",
"file", JULONG_FORMAT, JULONG_FORMAT, cache);
return cache;
}

char* CgroupV2Subsystem::mem_soft_limit_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/memory.low",
"Memory Soft Limit is: %s", "%s", mem_soft_limit_str, 1024);
Expand Down
2 changes: 2 additions & 0 deletions hotspot/src/os/linux/vm/cgroupV2Subsystem_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class CgroupV2Subsystem: public CgroupSubsystem {
jlong memory_soft_limit_in_bytes();
jlong memory_usage_in_bytes();
jlong memory_max_usage_in_bytes();
jlong rss_usage_in_bytes();
jlong cache_usage_in_bytes();

char * cpu_cpuset_cpus();
char * cpu_cpuset_memory_nodes();
Expand Down
10 changes: 10 additions & 0 deletions hotspot/src/os/linux/vm/osContainer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ jlong OSContainer::memory_max_usage_in_bytes() {
return cgroup_subsystem->memory_max_usage_in_bytes();
}

jlong OSContainer::rss_usage_in_bytes() {
assert(cgroup_subsystem != NULL, "cgroup subsystem not available");
return cgroup_subsystem->rss_usage_in_bytes();
}

jlong OSContainer::cache_usage_in_bytes() {
assert(cgroup_subsystem != NULL, "cgroup subsystem not available");
return cgroup_subsystem->cache_usage_in_bytes();
}

void OSContainer::print_version_specific_info(outputStream* st) {
assert(cgroup_subsystem != NULL, "cgroup subsystem not available");
cgroup_subsystem->print_version_specific_info(st);
Expand Down
2 changes: 2 additions & 0 deletions hotspot/src/os/linux/vm/osContainer_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class OSContainer: AllStatic {
static jlong memory_soft_limit_in_bytes();
static jlong memory_usage_in_bytes();
static jlong memory_max_usage_in_bytes();
static jlong rss_usage_in_bytes();
static jlong cache_usage_in_bytes();

static int active_processor_count();

Expand Down
2 changes: 2 additions & 0 deletions hotspot/src/os/linux/vm/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,8 @@ void os::Linux::print_container_info(outputStream* st) {
OSContainer::print_container_helper(st, OSContainer::memory_soft_limit_in_bytes(), "memory_soft_limit_in_bytes");
OSContainer::print_container_helper(st, OSContainer::memory_usage_in_bytes(), "memory_usage_in_bytes");
OSContainer::print_container_helper(st, OSContainer::memory_max_usage_in_bytes(), "memory_max_usage_in_bytes");
OSContainer::print_container_helper(st, OSContainer::rss_usage_in_bytes(), "rss_usage_in_bytes");
OSContainer::print_container_helper(st, OSContainer::cache_usage_in_bytes(), "cache_usage_in_bytes");

OSContainer::print_version_specific_info(st);

Expand Down
4 changes: 3 additions & 1 deletion hotspot/test/runtime/containers/docker/TestMisc.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ private static void checkContainerInfo(OutputAnalyzer out) throws Exception {
"Memory Soft Limit",
"Memory Usage",
"Maximum Memory Usage",
"memory_max_usage_in_bytes"
"memory_max_usage_in_bytes",
"rss_usage_in_bytes",
"cache_usage_in_bytes"
};

for (String s : expectedToContain) {
Expand Down