comparison src/os/linux/vm/os_linux.cpp @ 18009:f73af4455d7d

Merge
author asaha
date Thu, 29 May 2014 09:56:06 -0700
parents 364b73402247 78bbf4d43a14
children 52b4284cb496 d22136881b85
comparison
equal deleted inserted replaced
18008:da65bbf6f89e 18009:f73af4455d7d
98 # include <sys/shm.h> 98 # include <sys/shm.h>
99 # include <link.h> 99 # include <link.h>
100 # include <stdint.h> 100 # include <stdint.h>
101 # include <inttypes.h> 101 # include <inttypes.h>
102 # include <sys/ioctl.h> 102 # include <sys/ioctl.h>
103
104 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
103 105
104 // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling 106 // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
105 // getrusage() is prepared to handle the associated failure. 107 // getrusage() is prepared to handle the associated failure.
106 #ifndef RUSAGE_THREAD 108 #ifndef RUSAGE_THREAD
107 #define RUSAGE_THREAD (1) /* only the calling thread */ 109 #define RUSAGE_THREAD (1) /* only the calling thread */
2132 os::Posix::print_uname_info(st); 2134 os::Posix::print_uname_info(st);
2133 2135
2134 // Print warning if unsafe chroot environment detected 2136 // Print warning if unsafe chroot environment detected
2135 if (unsafe_chroot_detected) { 2137 if (unsafe_chroot_detected) {
2136 st->print("WARNING!! "); 2138 st->print("WARNING!! ");
2137 st->print_cr(unstable_chroot_error); 2139 st->print_cr("%s", unstable_chroot_error);
2138 } 2140 }
2139 2141
2140 os::Linux::print_libversion_info(st); 2142 os::Linux::print_libversion_info(st);
2141 2143
2142 os::Posix::print_rlimit_info(st); 2144 os::Posix::print_rlimit_info(st);
2193 } 2195 }
2194 2196
2195 void os::Linux::print_libversion_info(outputStream* st) { 2197 void os::Linux::print_libversion_info(outputStream* st) {
2196 // libc, pthread 2198 // libc, pthread
2197 st->print("libc:"); 2199 st->print("libc:");
2198 st->print(os::Linux::glibc_version()); st->print(" "); 2200 st->print("%s ", os::Linux::glibc_version());
2199 st->print(os::Linux::libpthread_version()); st->print(" "); 2201 st->print("%s ", os::Linux::libpthread_version());
2200 if (os::Linux::is_LinuxThreads()) { 2202 if (os::Linux::is_LinuxThreads()) {
2201 st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); 2203 st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
2202 } 2204 }
2203 st->cr(); 2205 st->cr();
2204 } 2206 }
3411 // they are so fragmented after a long run that they can't 3413 // they are so fragmented after a long run that they can't
3412 // coalesce into large pages. Try to reserve large pages when 3414 // coalesce into large pages. Try to reserve large pages when
3413 // the system is still "fresh". 3415 // the system is still "fresh".
3414 if (warn_on_failure) { 3416 if (warn_on_failure) {
3415 jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); 3417 jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
3416 warning(msg); 3418 warning("%s", msg);
3417 } 3419 }
3418 return NULL; 3420 return NULL;
3419 } 3421 }
3420 3422
3421 // attach to the region 3423 // attach to the region
3429 shmctl(shmid, IPC_RMID, NULL); 3431 shmctl(shmid, IPC_RMID, NULL);
3430 3432
3431 if ((intptr_t)addr == -1) { 3433 if ((intptr_t)addr == -1) {
3432 if (warn_on_failure) { 3434 if (warn_on_failure) {
3433 jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); 3435 jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
3434 warning(msg); 3436 warning("%s", msg);
3435 } 3437 }
3436 return NULL; 3438 return NULL;
3437 } 3439 }
3438 3440
3439 return addr; 3441 return addr;
3449 3451
3450 if (warn_on_failure) { 3452 if (warn_on_failure) {
3451 char msg[128]; 3453 char msg[128];
3452 jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: " 3454 jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: "
3453 PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error); 3455 PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error);
3454 warning(msg); 3456 warning("%s", msg);
3455 } 3457 }
3456 } 3458 }
3457 3459
3458 char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_addr, bool exec) { 3460 char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_addr, bool exec) {
3459 assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages"); 3461 assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages");
5388 5390
5389 // 5391 //
5390 // -1 on error. 5392 // -1 on error.
5391 // 5393 //
5392 5394
5395 PRAGMA_DIAG_PUSH
5396 PRAGMA_FORMAT_NONLITERAL_IGNORED
5393 static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { 5397 static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
5394 static bool proc_task_unchecked = true; 5398 static bool proc_task_unchecked = true;
5395 static const char *proc_stat_path = "/proc/%d/stat"; 5399 static const char *proc_stat_path = "/proc/%d/stat";
5396 pid_t tid = thread->osthread()->thread_id(); 5400 pid_t tid = thread->osthread()->thread_id();
5397 char *s; 5401 char *s;
5449 return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec); 5453 return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec);
5450 } else { 5454 } else {
5451 return (jlong)user_time * (1000000000 / clock_tics_per_sec); 5455 return (jlong)user_time * (1000000000 / clock_tics_per_sec);
5452 } 5456 }
5453 } 5457 }
5458 PRAGMA_DIAG_POP
5454 5459
5455 void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) { 5460 void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) {
5456 info_ptr->max_value = ALL_64_BITS; // will not wrap in less than 64 bits 5461 info_ptr->max_value = ALL_64_BITS; // will not wrap in less than 64 bits
5457 info_ptr->may_skip_backward = false; // elapsed time not wall time 5462 info_ptr->may_skip_backward = false; // elapsed time not wall time
5458 info_ptr->may_skip_forward = false; // elapsed time not wall time 5463 info_ptr->may_skip_forward = false; // elapsed time not wall time