Mercurial > hg > truffle
comparison src/os/linux/vm/os_linux.cpp @ 12177:0d59407e7e09
Merge
author | jmasa |
---|---|
date | Thu, 29 Aug 2013 06:53:16 -0700 |
parents | 4c84d351cca9 88c255656030 |
children | bb57d48691f5 |
comparison
equal
deleted
inserted
replaced
12116:1624a68007bd | 12177:0d59407e7e09 |
---|---|
2765 | 2765 |
2766 void os::numa_make_global(char *addr, size_t bytes) { | 2766 void os::numa_make_global(char *addr, size_t bytes) { |
2767 Linux::numa_interleave_memory(addr, bytes); | 2767 Linux::numa_interleave_memory(addr, bytes); |
2768 } | 2768 } |
2769 | 2769 |
2770 // Define for numa_set_bind_policy(int). Setting the argument to 0 will set the | |
2771 // bind policy to MPOL_PREFERRED for the current thread. | |
2772 #define USE_MPOL_PREFERRED 0 | |
2773 | |
2770 void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { | 2774 void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { |
2775 // To make NUMA and large pages more robust when both enabled, we need to ease | |
2776 // the requirements on where the memory should be allocated. MPOL_BIND is the | |
2777 // default policy and it will force memory to be allocated on the specified | |
2778 // node. Changing this to MPOL_PREFERRED will prefer to allocate the memory on | |
2779 // the specified node, but will not force it. Using this policy will prevent | |
2780 // getting SIGBUS when trying to allocate large pages on NUMA nodes with no | |
2781 // free large pages. | |
2782 Linux::numa_set_bind_policy(USE_MPOL_PREFERRED); | |
2771 Linux::numa_tonode_memory(addr, bytes, lgrp_hint); | 2783 Linux::numa_tonode_memory(addr, bytes, lgrp_hint); |
2772 } | 2784 } |
2773 | 2785 |
2774 bool os::numa_topology_changed() { return false; } | 2786 bool os::numa_topology_changed() { return false; } |
2775 | 2787 |
2867 libnuma_dlsym(handle, "numa_available"))); | 2879 libnuma_dlsym(handle, "numa_available"))); |
2868 set_numa_tonode_memory(CAST_TO_FN_PTR(numa_tonode_memory_func_t, | 2880 set_numa_tonode_memory(CAST_TO_FN_PTR(numa_tonode_memory_func_t, |
2869 libnuma_dlsym(handle, "numa_tonode_memory"))); | 2881 libnuma_dlsym(handle, "numa_tonode_memory"))); |
2870 set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t, | 2882 set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t, |
2871 libnuma_dlsym(handle, "numa_interleave_memory"))); | 2883 libnuma_dlsym(handle, "numa_interleave_memory"))); |
2884 set_numa_set_bind_policy(CAST_TO_FN_PTR(numa_set_bind_policy_func_t, | |
2885 libnuma_dlsym(handle, "numa_set_bind_policy"))); | |
2872 | 2886 |
2873 | 2887 |
2874 if (numa_available() != -1) { | 2888 if (numa_available() != -1) { |
2875 set_numa_all_nodes((unsigned long*)libnuma_dlsym(handle, "numa_all_nodes")); | 2889 set_numa_all_nodes((unsigned long*)libnuma_dlsym(handle, "numa_all_nodes")); |
2876 // Create a cpu -> node mapping | 2890 // Create a cpu -> node mapping |
2933 os::Linux::numa_node_to_cpus_func_t os::Linux::_numa_node_to_cpus; | 2947 os::Linux::numa_node_to_cpus_func_t os::Linux::_numa_node_to_cpus; |
2934 os::Linux::numa_max_node_func_t os::Linux::_numa_max_node; | 2948 os::Linux::numa_max_node_func_t os::Linux::_numa_max_node; |
2935 os::Linux::numa_available_func_t os::Linux::_numa_available; | 2949 os::Linux::numa_available_func_t os::Linux::_numa_available; |
2936 os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory; | 2950 os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory; |
2937 os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory; | 2951 os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory; |
2952 os::Linux::numa_set_bind_policy_func_t os::Linux::_numa_set_bind_policy; | |
2938 unsigned long* os::Linux::_numa_all_nodes; | 2953 unsigned long* os::Linux::_numa_all_nodes; |
2939 | 2954 |
2940 bool os::pd_uncommit_memory(char* addr, size_t size) { | 2955 bool os::pd_uncommit_memory(char* addr, size_t size) { |
2941 uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE, | 2956 uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE, |
2942 MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); | 2957 MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); |