3070 do {
3071 char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
3072 if (extra_base == NULL) {
3073 return NULL;
3074 }
3075 // Do manual alignment
3076 aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
3077
3078 os::release_memory(extra_base, extra_size);
3079
3080 aligned_base = os::reserve_memory(size, aligned_base);
3081
3082 } while (aligned_base == NULL);
3083
3084 return aligned_base;
3085 }
3086
3087 char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
3088 assert((size_t)addr % os::vm_allocation_granularity() == 0,
3089 "reserve alignment");
3090 assert(bytes % os::vm_allocation_granularity() == 0, "reserve block size");
3091 char* res;
3092 // note that if UseLargePages is on, all the areas that require interleaving
3093 // will go thru reserve_memory_special rather than thru here.
3094 bool use_individual = (UseNUMAInterleaving && !UseLargePages);
3095 if (!use_individual) {
3096 res = (char*)VirtualAlloc(addr, bytes, MEM_RESERVE, PAGE_READWRITE);
3097 } else {
3098 elapsedTimer reserveTimer;
3099 if (Verbose && PrintMiscellaneous) reserveTimer.start();
3100 // in numa interleaving, we have to allocate pages individually
3101 // (well really chunks of NUMAInterleaveGranularity size)
3102 res = allocate_pages_individually(bytes, addr, MEM_RESERVE, PAGE_READWRITE);
3103 if (res == NULL) {
3104 warning("NUMA page allocation failed");
3105 }
3106 if (Verbose && PrintMiscellaneous) {
3107 reserveTimer.stop();
3108 tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
3109 reserveTimer.milliseconds(), reserveTimer.ticks());
3110 }
|
3070 do {
3071 char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
3072 if (extra_base == NULL) {
3073 return NULL;
3074 }
3075 // Do manual alignment
3076 aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
3077
3078 os::release_memory(extra_base, extra_size);
3079
3080 aligned_base = os::reserve_memory(size, aligned_base);
3081
3082 } while (aligned_base == NULL);
3083
3084 return aligned_base;
3085 }
3086
3087 char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
3088 assert((size_t)addr % os::vm_allocation_granularity() == 0,
3089 "reserve alignment");
3090 assert(bytes % os::vm_page_size() == 0, "reserve page size");
3091 char* res;
3092 // note that if UseLargePages is on, all the areas that require interleaving
3093 // will go thru reserve_memory_special rather than thru here.
3094 bool use_individual = (UseNUMAInterleaving && !UseLargePages);
3095 if (!use_individual) {
3096 res = (char*)VirtualAlloc(addr, bytes, MEM_RESERVE, PAGE_READWRITE);
3097 } else {
3098 elapsedTimer reserveTimer;
3099 if (Verbose && PrintMiscellaneous) reserveTimer.start();
3100 // in numa interleaving, we have to allocate pages individually
3101 // (well really chunks of NUMAInterleaveGranularity size)
3102 res = allocate_pages_individually(bytes, addr, MEM_RESERVE, PAGE_READWRITE);
3103 if (res == NULL) {
3104 warning("NUMA page allocation failed");
3105 }
3106 if (Verbose && PrintMiscellaneous) {
3107 reserveTimer.stop();
3108 tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
3109 reserveTimer.milliseconds(), reserveTimer.ticks());
3110 }
|