2704 // scenario, I found through experiment it only uses large page if the entire
2705 // memory region is reserved and committed in a single VirtualAlloc() call.
2706 // This makes Windows large page support more or less like Solaris ISM, in
2707 // that the entire heap must be committed upfront. This probably will change
2708 // in the future, if so the code below needs to be revisited.
2709
2710 #ifndef MEM_LARGE_PAGES
2711 #define MEM_LARGE_PAGES 0x20000000
2712 #endif
2713
2714 static HANDLE _hProcess;
2715 static HANDLE _hToken;
2716
2717 // Container for NUMA node list info
2718 class NUMANodeListHolder {
2719 private:
2720 int *_numa_used_node_list; // allocated below
2721 int _numa_used_node_count;
2722
2723 void free_node_list() {
2724 if (_numa_used_node_list != NULL) {
2725 FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
2726 }
2727 }
2728
2729 public:
2730 NUMANodeListHolder() {
2731 _numa_used_node_count = 0;
2732 _numa_used_node_list = NULL;
2733 // do rest of initialization in build routine (after function pointers are set up)
2734 }
2735
2736 ~NUMANodeListHolder() {
2737 free_node_list();
2738 }
2739
2740 bool build() {
2741 DWORD_PTR proc_aff_mask;
2742 DWORD_PTR sys_aff_mask;
2743 if (!GetProcessAffinityMask(GetCurrentProcess(), &proc_aff_mask, &sys_aff_mask)) return false;
2744 ULONG highest_node_number;
2745 if (!GetNumaHighestNodeNumber(&highest_node_number)) return false;
2746 free_node_list();
|
2704 // scenario, I found through experiment it only uses large page if the entire
2705 // memory region is reserved and committed in a single VirtualAlloc() call.
2706 // This makes Windows large page support more or less like Solaris ISM, in
2707 // that the entire heap must be committed upfront. This probably will change
2708 // in the future, if so the code below needs to be revisited.
2709
2710 #ifndef MEM_LARGE_PAGES
2711 #define MEM_LARGE_PAGES 0x20000000
2712 #endif
2713
2714 static HANDLE _hProcess;
2715 static HANDLE _hToken;
2716
2717 // Container for NUMA node list info
2718 class NUMANodeListHolder {
2719 private:
2720 int *_numa_used_node_list; // allocated below
2721 int _numa_used_node_count;
2722
2723 void free_node_list() {
2724 FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
2725 }
2726
2727 public:
2728 NUMANodeListHolder() {
2729 _numa_used_node_count = 0;
2730 _numa_used_node_list = NULL;
2731 // do rest of initialization in build routine (after function pointers are set up)
2732 }
2733
2734 ~NUMANodeListHolder() {
2735 free_node_list();
2736 }
2737
2738 bool build() {
2739 DWORD_PTR proc_aff_mask;
2740 DWORD_PTR sys_aff_mask;
2741 if (!GetProcessAffinityMask(GetCurrentProcess(), &proc_aff_mask, &sys_aff_mask)) return false;
2742 ULONG highest_node_number;
2743 if (!GetNumaHighestNodeNumber(&highest_node_number)) return false;
2744 free_node_list();
|