< prev index next >

src/hotspot/os/linux/osContainer_linux.cpp

Print this page




 450 }
 451 
 452 
 453 /* memory_limit_in_bytes
 454  *
 455  * Return the limit of available memory for this process.
 456  *
 457  * return:
 458  *    memory limit in bytes or
 459  *    -1 for unlimited
 460  *    OSCONTAINER_ERROR for not supported
 461  */
 462 jlong OSContainer::memory_limit_in_bytes() {
 463   GET_CONTAINER_INFO(julong, memory, "/memory.limit_in_bytes",
 464                      "Memory Limit is: " JULONG_FORMAT, JULONG_FORMAT, memlimit);
 465 
 466   if (memlimit >= _unlimited_memory) {
 467     log_trace(os, container)("Non-Hierarchical Memory Limit is: Unlimited");
 468     if (memory->is_hierarchical()) {
 469       const char* matchline = "hierarchical_memory_limit";
 470       char* format = "%s " JULONG_FORMAT;
 471       GET_CONTAINER_INFO_LINE(julong, memory, "/memory.stat", matchline,
 472                              "Hierarchical Memory Limit is: " JULONG_FORMAT, format, hier_memlimit)
 473       if (hier_memlimit >= _unlimited_memory) {
 474         log_trace(os, container)("Hierarchical Memory Limit is: Unlimited");
 475       } else {
 476         return (jlong)hier_memlimit;
 477       }
 478     }
 479     return (jlong)-1;
 480   }
 481   else {
 482     return (jlong)memlimit;
 483   }
 484 }
 485 
 486 jlong OSContainer::memory_and_swap_limit_in_bytes() {
 487   GET_CONTAINER_INFO(julong, memory, "/memory.memsw.limit_in_bytes",
 488                      "Memory and Swap Limit is: " JULONG_FORMAT, JULONG_FORMAT, memswlimit);
 489   if (memswlimit >= _unlimited_memory) {
 490     log_trace(os, container)("Non-Hierarchical Memory and Swap Limit is: Unlimited");
 491     if (memory->is_hierarchical()) {
 492       const char* matchline = "hierarchical_memsw_limit";
 493       char* format = "%s " JULONG_FORMAT;
 494       GET_CONTAINER_INFO_LINE(julong, memory, "/memory.stat", matchline,
 495                              "Hierarchical Memory and Swap Limit is : " JULONG_FORMAT, format, hier_memlimit)
 496       if (hier_memlimit >= _unlimited_memory) {
 497         log_trace(os, container)("Hierarchical Memory and Swap Limit is: Unlimited");
 498       } else {
 499         return (jlong)hier_memlimit;
 500       }
 501     }
 502     return (jlong)-1;
 503   } else {
 504     return (jlong)memswlimit;
 505   }
 506 }
 507 
 508 jlong OSContainer::memory_soft_limit_in_bytes() {
 509   GET_CONTAINER_INFO(julong, memory, "/memory.soft_limit_in_bytes",
 510                      "Memory Soft Limit is: " JULONG_FORMAT, JULONG_FORMAT, memsoftlimit);
 511   if (memsoftlimit >= _unlimited_memory) {
 512     log_trace(os, container)("Memory Soft Limit is: Unlimited");
 513     return (jlong)-1;




 450 }
 451 
 452 
 453 /* memory_limit_in_bytes
 454  *
 455  * Return the limit of available memory for this process.
 456  *
 457  * return:
 458  *    memory limit in bytes or
 459  *    -1 for unlimited
 460  *    OSCONTAINER_ERROR for not supported
 461  */
 462 jlong OSContainer::memory_limit_in_bytes() {
 463   GET_CONTAINER_INFO(julong, memory, "/memory.limit_in_bytes",
 464                      "Memory Limit is: " JULONG_FORMAT, JULONG_FORMAT, memlimit);
 465 
 466   if (memlimit >= _unlimited_memory) {
 467     log_trace(os, container)("Non-Hierarchical Memory Limit is: Unlimited");
 468     if (memory->is_hierarchical()) {
 469       const char* matchline = "hierarchical_memory_limit";
 470       const char* format = "%s " JULONG_FORMAT;
 471       GET_CONTAINER_INFO_LINE(julong, memory, "/memory.stat", matchline,
 472                              "Hierarchical Memory Limit is: " JULONG_FORMAT, format, hier_memlimit)
 473       if (hier_memlimit >= _unlimited_memory) {
 474         log_trace(os, container)("Hierarchical Memory Limit is: Unlimited");
 475       } else {
 476         return (jlong)hier_memlimit;
 477       }
 478     }
 479     return (jlong)-1;
 480   }
 481   else {
 482     return (jlong)memlimit;
 483   }
 484 }
 485 
 486 jlong OSContainer::memory_and_swap_limit_in_bytes() {
 487   GET_CONTAINER_INFO(julong, memory, "/memory.memsw.limit_in_bytes",
 488                      "Memory and Swap Limit is: " JULONG_FORMAT, JULONG_FORMAT, memswlimit);
 489   if (memswlimit >= _unlimited_memory) {
 490     log_trace(os, container)("Non-Hierarchical Memory and Swap Limit is: Unlimited");
 491     if (memory->is_hierarchical()) {
 492       const char* matchline = "hierarchical_memsw_limit";
 493       const char* format = "%s " JULONG_FORMAT;
 494       GET_CONTAINER_INFO_LINE(julong, memory, "/memory.stat", matchline,
 495                              "Hierarchical Memory and Swap Limit is : " JULONG_FORMAT, format, hier_memlimit)
 496       if (hier_memlimit >= _unlimited_memory) {
 497         log_trace(os, container)("Hierarchical Memory and Swap Limit is: Unlimited");
 498       } else {
 499         return (jlong)hier_memlimit;
 500       }
 501     }
 502     return (jlong)-1;
 503   } else {
 504     return (jlong)memswlimit;
 505   }
 506 }
 507 
 508 jlong OSContainer::memory_soft_limit_in_bytes() {
 509   GET_CONTAINER_INFO(julong, memory, "/memory.soft_limit_in_bytes",
 510                      "Memory Soft Limit is: " JULONG_FORMAT, JULONG_FORMAT, memsoftlimit);
 511   if (memsoftlimit >= _unlimited_memory) {
 512     log_trace(os, container)("Memory Soft Limit is: Unlimited");
 513     return (jlong)-1;


< prev index next >