Mercurial > hg > graal-compiler
comparison src/os/windows/vm/os_windows.cpp @ 3918:a6128a8ed624
7086226: UseNUMA fails on old versions of windows
Summary: Return correct answers from os::numa_*() for UMA machines or if NUMA API is not supported
Reviewed-by: johnc
author | iveresov |
---|---|
date | Wed, 07 Sep 2011 18:58:33 -0700 |
parents | 3cd0157e1d4d |
children | 0a63380c8ac8 |
comparison
equal
deleted
inserted
replaced
3917:eca1193ca245 | 3918:a6128a8ed624 |
---|---|
2704 _hToken = NULL; | 2704 _hToken = NULL; |
2705 } | 2705 } |
2706 | 2706 |
2707 static bool numa_interleaving_init() { | 2707 static bool numa_interleaving_init() { |
2708 bool success = false; | 2708 bool success = false; |
2709 bool use_numa_specified = !FLAG_IS_DEFAULT(UseNUMA); | |
2710 bool use_numa_interleaving_specified = !FLAG_IS_DEFAULT(UseNUMAInterleaving); | 2709 bool use_numa_interleaving_specified = !FLAG_IS_DEFAULT(UseNUMAInterleaving); |
2711 | 2710 |
2712 // print a warning if UseNUMA or UseNUMAInterleaving flag is specified on command line | 2711 // print a warning if UseNUMAInterleaving flag is specified on command line |
2713 bool warn_on_failure = use_numa_specified || use_numa_interleaving_specified; | 2712 bool warn_on_failure = use_numa_interleaving_specified; |
2714 # define WARN(msg) if (warn_on_failure) { warning(msg); } | 2713 # define WARN(msg) if (warn_on_failure) { warning(msg); } |
2715 | 2714 |
2716 // NUMAInterleaveGranularity cannot be less than vm_allocation_granularity (or _large_page_size if using large pages) | 2715 // NUMAInterleaveGranularity cannot be less than vm_allocation_granularity (or _large_page_size if using large pages) |
2717 size_t min_interleave_granularity = UseLargePages ? _large_page_size : os::vm_allocation_granularity(); | 2716 size_t min_interleave_granularity = UseLargePages ? _large_page_size : os::vm_allocation_granularity(); |
2718 NUMAInterleaveGranularity = align_size_up(NUMAInterleaveGranularity, min_interleave_granularity); | 2717 NUMAInterleaveGranularity = align_size_up(NUMAInterleaveGranularity, min_interleave_granularity); |
2719 | 2718 |
2720 if (os::Kernel32Dll::NumaCallsAvailable()) { | 2719 if (os::Kernel32Dll::NumaCallsAvailable()) { |
2721 if (numa_node_list_holder.build()) { | 2720 if (numa_node_list_holder.build()) { |
2722 if (PrintMiscellaneous && Verbose) { | 2721 if (PrintMiscellaneous && Verbose) { |
2723 tty->print("NUMA UsedNodeCount=%d, namely ", os::numa_get_groups_num()); | 2722 tty->print("NUMA UsedNodeCount=%d, namely ", numa_node_list_holder.get_count()); |
2724 for (int i = 0; i < numa_node_list_holder.get_count(); i++) { | 2723 for (int i = 0; i < numa_node_list_holder.get_count(); i++) { |
2725 tty->print("%d ", numa_node_list_holder.get_node_list_entry(i)); | 2724 tty->print("%d ", numa_node_list_holder.get_node_list_entry(i)); |
2726 } | 2725 } |
2727 tty->print("\n"); | 2726 tty->print("\n"); |
2728 } | 2727 } |
2732 } | 2731 } |
2733 } else { | 2732 } else { |
2734 WARN("NUMA Interleaving is not supported by the operating system."); | 2733 WARN("NUMA Interleaving is not supported by the operating system."); |
2735 } | 2734 } |
2736 if (!success) { | 2735 if (!success) { |
2737 if (use_numa_specified) WARN("...Ignoring UseNUMA flag."); | |
2738 if (use_numa_interleaving_specified) WARN("...Ignoring UseNUMAInterleaving flag."); | 2736 if (use_numa_interleaving_specified) WARN("...Ignoring UseNUMAInterleaving flag."); |
2739 } | 2737 } |
2740 return success; | 2738 return success; |
2741 #undef WARN | 2739 #undef WARN |
2742 } | 2740 } |
2814 bytes_to_rq, | 2812 bytes_to_rq, |
2815 flags, | 2813 flags, |
2816 prot); | 2814 prot); |
2817 } else { | 2815 } else { |
2818 // get the next node to use from the used_node_list | 2816 // get the next node to use from the used_node_list |
2819 DWORD node = numa_node_list_holder.get_node_list_entry(count % os::numa_get_groups_num()); | 2817 assert(numa_node_list_holder.get_count() > 0, "Multiple NUMA nodes expected"); |
2818 DWORD node = numa_node_list_holder.get_node_list_entry(count % numa_node_list_holder.get_count()); | |
2820 p_new = (char *)os::Kernel32Dll::VirtualAllocExNuma(hProc, | 2819 p_new = (char *)os::Kernel32Dll::VirtualAllocExNuma(hProc, |
2821 next_alloc_addr, | 2820 next_alloc_addr, |
2822 bytes_to_rq, | 2821 bytes_to_rq, |
2823 flags, | 2822 flags, |
2824 prot, | 2823 prot, |
3130 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { } | 3129 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { } |
3131 void os::free_memory(char *addr, size_t bytes) { } | 3130 void os::free_memory(char *addr, size_t bytes) { } |
3132 void os::numa_make_global(char *addr, size_t bytes) { } | 3131 void os::numa_make_global(char *addr, size_t bytes) { } |
3133 void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { } | 3132 void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { } |
3134 bool os::numa_topology_changed() { return false; } | 3133 bool os::numa_topology_changed() { return false; } |
3135 size_t os::numa_get_groups_num() { return numa_node_list_holder.get_count(); } | 3134 size_t os::numa_get_groups_num() { return MAX2(numa_node_list_holder.get_count(), 1); } |
3136 int os::numa_get_group_id() { return 0; } | 3135 int os::numa_get_group_id() { return 0; } |
3137 size_t os::numa_get_leaf_groups(int *ids, size_t size) { | 3136 size_t os::numa_get_leaf_groups(int *ids, size_t size) { |
3138 // check for size bigger than actual groups_num | 3137 if (numa_node_list_holder.get_count() == 0 && size > 0) { |
3139 size = MIN2(size, numa_get_groups_num()); | 3138 // Provide an answer for UMA systems |
3140 for (int i = 0; i < (int)size; i++) { | 3139 ids[0] = 0; |
3141 ids[i] = numa_node_list_holder.get_node_list_entry(i); | 3140 return 1; |
3142 } | 3141 } else { |
3143 return size; | 3142 // check for size bigger than actual groups_num |
3143 size = MIN2(size, numa_get_groups_num()); | |
3144 for (int i = 0; i < (int)size; i++) { | |
3145 ids[i] = numa_node_list_holder.get_node_list_entry(i); | |
3146 } | |
3147 return size; | |
3148 } | |
3144 } | 3149 } |
3145 | 3150 |
3146 bool os::get_page_info(char *start, page_info* info) { | 3151 bool os::get_page_info(char *start, page_info* info) { |
3147 return false; | 3152 return false; |
3148 } | 3153 } |
3765 NOT_PRODUCT(if (PrintMiscellaneous && Verbose) nx_check_protection()); | 3770 NOT_PRODUCT(if (PrintMiscellaneous && Verbose) nx_check_protection()); |
3766 #endif | 3771 #endif |
3767 | 3772 |
3768 // initialize thread priority policy | 3773 // initialize thread priority policy |
3769 prio_init(); | 3774 prio_init(); |
3775 | |
3776 if (UseNUMA && !ForceNUMA) { | |
3777 UseNUMA = false; // We don't fully support this yet | |
3778 } | |
3770 | 3779 |
3771 if (UseNUMAInterleaving) { | 3780 if (UseNUMAInterleaving) { |
3772 // first check whether this Windows OS supports VirtualAllocExNuma, if not ignore this flag | 3781 // first check whether this Windows OS supports VirtualAllocExNuma, if not ignore this flag |
3773 bool success = numa_interleaving_init(); | 3782 bool success = numa_interleaving_init(); |
3774 if (!success) UseNUMAInterleaving = false; | 3783 if (!success) UseNUMAInterleaving = false; |