comparison src/os/solaris/vm/os_solaris.cpp @ 8883:b9a918201d47

Merge with hsx25
author Gilles Duboscq <duboscq@ssw.jku.at>
date Sat, 06 Apr 2013 20:04:06 +0200
parents b8f261ba79c6 754c24457b20
children 89e4d67fdd2a
comparison
equal deleted inserted replaced
8660:d47b52b0ff68 8883:b9a918201d47
472 472
473 julong os::Solaris::_physical_memory = 0; 473 julong os::Solaris::_physical_memory = 0;
474 474
475 julong os::physical_memory() { 475 julong os::physical_memory() {
476 return Solaris::physical_memory(); 476 return Solaris::physical_memory();
477 }
478
479 julong os::allocatable_physical_memory(julong size) {
480 #ifdef _LP64
481 return size;
482 #else
483 julong result = MIN2(size, (julong)3835*M);
484 if (!is_allocatable(result)) {
485 // Memory allocations will be aligned but the alignment
486 // is not known at this point. Alignments will
487 // be at most to LargePageSizeInBytes. Protect
488 // allocations from alignments up to illegal
489 // values. If at this point 2G is illegal.
490 julong reasonable_size = (julong)2*G - 2 * LargePageSizeInBytes;
491 result = MIN2(size, reasonable_size);
492 }
493 return result;
494 #endif
495 } 477 }
496 478
497 static hrtime_t first_hrtime = 0; 479 static hrtime_t first_hrtime = 0;
498 static const hrtime_t hrtime_hz = 1000*1000*1000; 480 static const hrtime_t hrtime_hz = 1000*1000*1000;
499 const int LOCK_BUSY = 1; 481 const int LOCK_BUSY = 1;
2943 size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size); 2925 size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size);
2944 uint64_t p = (uint64_t)start; 2926 uint64_t p = (uint64_t)start;
2945 while (p < (uint64_t)end) { 2927 while (p < (uint64_t)end) {
2946 addrs[0] = p; 2928 addrs[0] = p;
2947 size_t addrs_count = 1; 2929 size_t addrs_count = 1;
2948 while (addrs_count < MAX_MEMINFO_CNT && addrs[addrs_count - 1] < (uint64_t)end) { 2930 while (addrs_count < MAX_MEMINFO_CNT && addrs[addrs_count - 1] + page_size < (uint64_t)end) {
2949 addrs[addrs_count] = addrs[addrs_count - 1] + page_size; 2931 addrs[addrs_count] = addrs[addrs_count - 1] + page_size;
2950 addrs_count++; 2932 addrs_count++;
2951 } 2933 }
2952 2934
2953 if (os::Solaris::meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) { 2935 if (os::Solaris::meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) {
3418 return NULL; 3400 return NULL;
3419 } 3401 }
3420 if ((retAddr != NULL) && UseNUMAInterleaving) { 3402 if ((retAddr != NULL) && UseNUMAInterleaving) {
3421 numa_make_global(retAddr, size); 3403 numa_make_global(retAddr, size);
3422 } 3404 }
3405
3406 // The memory is committed
3407 address pc = CALLER_PC;
3408 MemTracker::record_virtual_memory_reserve((address)retAddr, size, pc);
3409 MemTracker::record_virtual_memory_commit((address)retAddr, size, pc);
3410
3423 return retAddr; 3411 return retAddr;
3424 } 3412 }
3425 3413
3426 bool os::release_memory_special(char* base, size_t bytes) { 3414 bool os::release_memory_special(char* base, size_t bytes) {
3427 // detaching the SHM segment will also delete it, see reserve_memory_special() 3415 // detaching the SHM segment will also delete it, see reserve_memory_special()
3428 int rslt = shmdt(base); 3416 int rslt = shmdt(base);
3429 return rslt == 0; 3417 if (rslt == 0) {
3418 MemTracker::record_virtual_memory_uncommit((address)base, bytes);
3419 MemTracker::record_virtual_memory_release((address)base, bytes);
3420 return true;
3421 } else {
3422 return false;
3423 }
3430 } 3424 }
3431 3425
3432 size_t os::large_page_size() { 3426 size_t os::large_page_size() {
3433 return _large_page_size; 3427 return _large_page_size;
3434 } 3428 }