3313
3314 void os::large_page_init() {
3315 if (!UseLargePages) {
3316 UseISM = false;
3317 UseMPSS = false;
3318 return;
3319 }
3320
3321 // print a warning if any large page related flag is specified on command line
3322 bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) ||
3323 !FLAG_IS_DEFAULT(UseISM) ||
3324 !FLAG_IS_DEFAULT(UseMPSS) ||
3325 !FLAG_IS_DEFAULT(LargePageSizeInBytes);
3326 UseISM = UseISM &&
3327 Solaris::ism_sanity_check(warn_on_failure, &_large_page_size);
3328 if (UseISM) {
3329 // ISM disables MPSS to be compatible with old JDK behavior
3330 UseMPSS = false;
3331 _page_sizes[0] = _large_page_size;
3332 _page_sizes[1] = vm_page_size();
3333 }
3334
3335 UseMPSS = UseMPSS &&
3336 Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
3337
3338 UseLargePages = UseISM || UseMPSS;
3339 }
3340
3341 bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
3342 // Signal to OS that we want large pages for addresses
3343 // from addr, addr + bytes
3344 struct memcntl_mha mpss_struct;
3345 mpss_struct.mha_cmd = MHA_MAPSIZE_VA;
3346 mpss_struct.mha_pagesize = align;
3347 mpss_struct.mha_flags = 0;
3348 if (memcntl(start, bytes, MC_HAT_ADVISE,
3349 (caddr_t) &mpss_struct, 0, 0) < 0) {
3350 debug_only(warning("Attempt to use MPSS failed."));
3351 return false;
3352 }
5058 polling_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE,
5059 PROT_READ);
5060 }
5061
5062 os::set_polling_page(polling_page);
5063
5064 #ifndef PRODUCT
5065 if( Verbose && PrintMiscellaneous )
5066 tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
5067 #endif
5068
5069 if (!UseMembar) {
5070 address mem_serialize_page = (address)Solaris::mmap_chunk( NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE );
5071 guarantee( mem_serialize_page != NULL, "mmap Failed for memory serialize page");
5072 os::set_memory_serialize_page( mem_serialize_page );
5073
5074 #ifndef PRODUCT
5075 if(Verbose && PrintMiscellaneous)
5076 tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
5077 #endif
5078 }
5079
5080 os::large_page_init();
5081
5082 // Check minimum allowable stack size for thread creation and to initialize
5083 // the java system classes, including StackOverflowError - depends on page
5084 // size. Add a page for compiler2 recursion in main thread.
5085 // Add in 2*BytesPerWord times page size to account for VM stack during
5086 // class initialization depending on 32 or 64 bit VM.
5087 os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed,
5088 (size_t)(StackYellowPages+StackRedPages+StackShadowPages+
5089 2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size);
5090
5091 size_t threadStackSizeInBytes = ThreadStackSize * K;
5092 if (threadStackSizeInBytes != 0 &&
5093 threadStackSizeInBytes < os::Solaris::min_stack_allowed) {
5094 tty->print_cr("\nThe stack size specified is too small, Specify at least %dk",
5095 os::Solaris::min_stack_allowed/K);
5096 return JNI_ERR;
5097 }
5098
5099 // For 64kbps there will be a 64kb page size, which makes
5100 // the usable default stack size quite a bit less. Increase the
|
3313
3314 void os::large_page_init() {
3315 if (!UseLargePages) {
3316 UseISM = false;
3317 UseMPSS = false;
3318 return;
3319 }
3320
3321 // print a warning if any large page related flag is specified on command line
3322 bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) ||
3323 !FLAG_IS_DEFAULT(UseISM) ||
3324 !FLAG_IS_DEFAULT(UseMPSS) ||
3325 !FLAG_IS_DEFAULT(LargePageSizeInBytes);
3326 UseISM = UseISM &&
3327 Solaris::ism_sanity_check(warn_on_failure, &_large_page_size);
3328 if (UseISM) {
3329 // ISM disables MPSS to be compatible with old JDK behavior
3330 UseMPSS = false;
3331 _page_sizes[0] = _large_page_size;
3332 _page_sizes[1] = vm_page_size();
3333 _page_sizes[2] = 0;
3334 }
3335
3336 UseMPSS = UseMPSS &&
3337 Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
3338
3339 UseLargePages = UseISM || UseMPSS;
3340 }
3341
3342 bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
3343 // Signal to OS that we want large pages for addresses
3344 // from addr, addr + bytes
3345 struct memcntl_mha mpss_struct;
3346 mpss_struct.mha_cmd = MHA_MAPSIZE_VA;
3347 mpss_struct.mha_pagesize = align;
3348 mpss_struct.mha_flags = 0;
3349 if (memcntl(start, bytes, MC_HAT_ADVISE,
3350 (caddr_t) &mpss_struct, 0, 0) < 0) {
3351 debug_only(warning("Attempt to use MPSS failed."));
3352 return false;
3353 }
5059 polling_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE,
5060 PROT_READ);
5061 }
5062
5063 os::set_polling_page(polling_page);
5064
5065 #ifndef PRODUCT
5066 if( Verbose && PrintMiscellaneous )
5067 tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
5068 #endif
5069
5070 if (!UseMembar) {
5071 address mem_serialize_page = (address)Solaris::mmap_chunk( NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE );
5072 guarantee( mem_serialize_page != NULL, "mmap Failed for memory serialize page");
5073 os::set_memory_serialize_page( mem_serialize_page );
5074
5075 #ifndef PRODUCT
5076 if(Verbose && PrintMiscellaneous)
5077 tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
5078 #endif
5079 }
5080
5081 // Check minimum allowable stack size for thread creation and to initialize
5082 // the java system classes, including StackOverflowError - depends on page
5083 // size. Add a page for compiler2 recursion in main thread.
5084 // Add in 2*BytesPerWord times page size to account for VM stack during
5085 // class initialization depending on 32 or 64 bit VM.
5086 os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed,
5087 (size_t)(StackYellowPages+StackRedPages+StackShadowPages+
5088 2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size);
5089
5090 size_t threadStackSizeInBytes = ThreadStackSize * K;
5091 if (threadStackSizeInBytes != 0 &&
5092 threadStackSizeInBytes < os::Solaris::min_stack_allowed) {
5093 tty->print_cr("\nThe stack size specified is too small, Specify at least %dk",
5094 os::Solaris::min_stack_allowed/K);
5095 return JNI_ERR;
5096 }
5097
5098 // For 64kbps there will be a 64kb page size, which makes
5099 // the usable default stack size quite a bit less. Increase the
|