3488 Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
3489
3490 UseLargePages = UseISM || UseMPSS;
3491 }
3492
3493 bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
3494 // Signal to OS that we want large pages for addresses
3495 // from addr, addr + bytes
3496 struct memcntl_mha mpss_struct;
3497 mpss_struct.mha_cmd = MHA_MAPSIZE_VA;
3498 mpss_struct.mha_pagesize = align;
3499 mpss_struct.mha_flags = 0;
3500 if (memcntl(start, bytes, MC_HAT_ADVISE,
3501 (caddr_t) &mpss_struct, 0, 0) < 0) {
3502 debug_only(warning("Attempt to use MPSS failed."));
3503 return false;
3504 }
3505 return true;
3506 }
3507
3508 char* os::reserve_memory_special(size_t size, char* addr, bool exec) {
3509 // "exec" is passed in but not used. Creating the shared image for
3510 // the code cache doesn't have an SHM_X executable permission to check.
3511 assert(UseLargePages && UseISM, "only for ISM large pages");
3512
3513 char* retAddr = NULL;
3514 int shmid;
3515 key_t ismKey;
3516
3517 bool warn_on_failure = UseISM &&
3518 (!FLAG_IS_DEFAULT(UseLargePages) ||
3519 !FLAG_IS_DEFAULT(UseISM) ||
3520 !FLAG_IS_DEFAULT(LargePageSizeInBytes)
3521 );
3522 char msg[128];
3523
3524 ismKey = IPC_PRIVATE;
3525
3526 // Create a large shared memory region to attach to based on size.
3527 // Currently, size is the total size of the heap
3528 shmid = shmget(ismKey, size, SHM_R | SHM_W | IPC_CREAT);
3529 if (shmid == -1){
3530 if (warn_on_failure) {
3531 jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
3532 warning(msg);
6824 return (ret == OS_ERR) ? 0 : 1;
6825 }
6826
6827 int os::bind(int fd, struct sockaddr* him, socklen_t len) {
6828 INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\
6829 os::Solaris::clear_interrupted);
6830 }
6831
6832 // Get the default path to the core file
6833 // Returns the length of the string
6834 int os::get_core_path(char* buffer, size_t bufferSize) {
6835 const char* p = get_current_directory(buffer, bufferSize);
6836
6837 if (p == NULL) {
6838 assert(p != NULL, "failed to get current directory");
6839 return 0;
6840 }
6841
6842 return strlen(buffer);
6843 }
|
3488 Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
3489
3490 UseLargePages = UseISM || UseMPSS;
3491 }
3492
3493 bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
3494 // Signal to OS that we want large pages for addresses
3495 // from addr, addr + bytes
3496 struct memcntl_mha mpss_struct;
3497 mpss_struct.mha_cmd = MHA_MAPSIZE_VA;
3498 mpss_struct.mha_pagesize = align;
3499 mpss_struct.mha_flags = 0;
3500 if (memcntl(start, bytes, MC_HAT_ADVISE,
3501 (caddr_t) &mpss_struct, 0, 0) < 0) {
3502 debug_only(warning("Attempt to use MPSS failed."));
3503 return false;
3504 }
3505 return true;
3506 }
3507
3508 char* os::reserve_memory_special(size_t size, size_t alignment, char* addr, bool exec) {
3509 // "exec" is passed in but not used. Creating the shared image for
3510 // the code cache doesn't have an SHM_X executable permission to check.
3511 assert(UseLargePages && UseISM, "only for ISM large pages");
3512
3513 if (!is_size_aligned(size, os::large_page_size()) || alignment > os::large_page_size()) {
3514 return NULL; // Fallback to small pages.
3515 }
3516
3517 char* retAddr = NULL;
3518 int shmid;
3519 key_t ismKey;
3520
3521 bool warn_on_failure = UseISM &&
3522 (!FLAG_IS_DEFAULT(UseLargePages) ||
3523 !FLAG_IS_DEFAULT(UseISM) ||
3524 !FLAG_IS_DEFAULT(LargePageSizeInBytes)
3525 );
3526 char msg[128];
3527
3528 ismKey = IPC_PRIVATE;
3529
3530 // Create a large shared memory region to attach to based on size.
3531 // Currently, size is the total size of the heap
3532 shmid = shmget(ismKey, size, SHM_R | SHM_W | IPC_CREAT);
3533 if (shmid == -1){
3534 if (warn_on_failure) {
3535 jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
3536 warning(msg);
6828 return (ret == OS_ERR) ? 0 : 1;
6829 }
6830
6831 int os::bind(int fd, struct sockaddr* him, socklen_t len) {
6832 INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\
6833 os::Solaris::clear_interrupted);
6834 }
6835
6836 // Get the default path to the core file
6837 // Returns the length of the string
6838 int os::get_core_path(char* buffer, size_t bufferSize) {
6839 const char* p = get_current_directory(buffer, bufferSize);
6840
6841 if (p == NULL) {
6842 assert(p != NULL, "failed to get current directory");
6843 return 0;
6844 }
6845
6846 return strlen(buffer);
6847 }
6848
6849 #ifndef PRODUCT
6850 void TestReserveMemorySpecial_test() {
6851 // No tests available for this platform
6852 }
6853 #endif
|