2529 return true; 2530 } 2531 // Fall through and try to use small pages 2532 } 2533 2534 if (commit_memory(addr, size, exec)) { 2535 realign_memory(addr, size, alignment_hint); 2536 return true; 2537 } 2538 return false; 2539 } 2540 2541 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { 2542 if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) { 2543 // We don't check the return value: madvise(MADV_HUGEPAGE) may not 2544 // be supported or the memory may already be backed by huge pages. 2545 ::madvise(addr, bytes, MADV_HUGEPAGE); 2546 } 2547 } 2548 2549 void os::free_memory(char *addr, size_t bytes) { 2550 commit_memory(addr, bytes, false); 2551 } 2552 2553 void os::numa_make_global(char *addr, size_t bytes) { 2554 Linux::numa_interleave_memory(addr, bytes); 2555 } 2556 2557 void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { 2558 Linux::numa_tonode_memory(addr, bytes, lgrp_hint); 2559 } 2560 2561 bool os::numa_topology_changed() { return false; } 2562 2563 size_t os::numa_get_groups_num() { 2564 int max_node = Linux::numa_max_node(); 2565 return max_node > 0 ? max_node + 1 : 1; 2566 } 2567 2568 int os::numa_get_group_id() { 2569 int cpu_id = Linux::sched_getcpu(); 2570 if (cpu_id != -1) { | 2529 return true; 2530 } 2531 // Fall through and try to use small pages 2532 } 2533 2534 if (commit_memory(addr, size, exec)) { 2535 realign_memory(addr, size, alignment_hint); 2536 return true; 2537 } 2538 return false; 2539 } 2540 2541 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { 2542 if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) { 2543 // We don't check the return value: madvise(MADV_HUGEPAGE) may not 2544 // be supported or the memory may already be backed by huge pages. 2545 ::madvise(addr, bytes, MADV_HUGEPAGE); 2546 } 2547 } 2548 2549 void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) { 2550 commit_memory(addr, bytes, alignment_hint, false); 2551 } 2552 2553 void os::numa_make_global(char *addr, size_t bytes) { 2554 Linux::numa_interleave_memory(addr, bytes); 2555 } 2556 2557 void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { 2558 Linux::numa_tonode_memory(addr, bytes, lgrp_hint); 2559 } 2560 2561 bool os::numa_topology_changed() { return false; } 2562 2563 size_t os::numa_get_groups_num() { 2564 int max_node = Linux::numa_max_node(); 2565 return max_node > 0 ? max_node + 1 : 1; 2566 } 2567 2568 int os::numa_get_group_id() { 2569 int cpu_id = Linux::sched_getcpu(); 2570 if (cpu_id != -1) { |