Mercurial > hg > graal-compiler
comparison src/os/linux/vm/os_linux.hpp @ 462:85f1b9537f70
6779436: NUMA allocator: libnuma expects certain size of the buffer in numa_node_to_cpus()
Summary: In os::Linux::rebuild_cpu_to_node_map() fix the size of the CPU bitmap. Fixed arithmetic in MutableNUMASpace::adaptive_chunk_size() that could cause overflows and underflows of the chunk_size variable.
Reviewed-by: apetrusenko
author | iveresov |
---|---|
date | Wed, 03 Dec 2008 14:18:57 -0800 |
parents | 9c2ecc2ffb12 |
children | cf71f149d7ae |
comparison
equal
deleted
inserted
replaced
457:27a80744a83b | 462:85f1b9537f70 |
---|---|
144 // NPTL is always floating stack. LinuxThreads could be using floating | 144 // NPTL is always floating stack. LinuxThreads could be using floating |
145 // stack or fixed stack. | 145 // stack or fixed stack. |
146 static bool is_floating_stack() { return _is_floating_stack; } | 146 static bool is_floating_stack() { return _is_floating_stack; } |
147 | 147 |
148 static void libpthread_init(); | 148 static void libpthread_init(); |
149 static void libnuma_init(); | 149 static bool libnuma_init(); |
150 | 150 |
151 // Minimum stack size a thread can be created with (allowing | 151 // Minimum stack size a thread can be created with (allowing |
152 // the VM to completely create the thread and enter user code) | 152 // the VM to completely create the thread and enter user code) |
153 static size_t min_stack_allowed; | 153 static size_t min_stack_allowed; |
154 | 154 |
238 typedef int (*sched_getcpu_func_t)(void); | 238 typedef int (*sched_getcpu_func_t)(void); |
239 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); | 239 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); |
240 typedef int (*numa_max_node_func_t)(void); | 240 typedef int (*numa_max_node_func_t)(void); |
241 typedef int (*numa_available_func_t)(void); | 241 typedef int (*numa_available_func_t)(void); |
242 typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node); | 242 typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node); |
243 | 243 typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask); |
244 | 244 |
245 static sched_getcpu_func_t _sched_getcpu; | 245 static sched_getcpu_func_t _sched_getcpu; |
246 static numa_node_to_cpus_func_t _numa_node_to_cpus; | 246 static numa_node_to_cpus_func_t _numa_node_to_cpus; |
247 static numa_max_node_func_t _numa_max_node; | 247 static numa_max_node_func_t _numa_max_node; |
248 static numa_available_func_t _numa_available; | 248 static numa_available_func_t _numa_available; |
249 static numa_tonode_memory_func_t _numa_tonode_memory; | 249 static numa_tonode_memory_func_t _numa_tonode_memory; |
250 static numa_interleave_memory_func_t _numa_interleave_memory; | |
251 static unsigned long* _numa_all_nodes; | |
250 | 252 |
251 static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; } | 253 static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; } |
252 static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; } | 254 static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; } |
253 static void set_numa_max_node(numa_max_node_func_t func) { _numa_max_node = func; } | 255 static void set_numa_max_node(numa_max_node_func_t func) { _numa_max_node = func; } |
254 static void set_numa_available(numa_available_func_t func) { _numa_available = func; } | 256 static void set_numa_available(numa_available_func_t func) { _numa_available = func; } |
255 static void set_numa_tonode_memory(numa_tonode_memory_func_t func) { _numa_tonode_memory = func; } | 257 static void set_numa_tonode_memory(numa_tonode_memory_func_t func) { _numa_tonode_memory = func; } |
256 | 258 static void set_numa_interleave_memory(numa_interleave_memory_func_t func) { _numa_interleave_memory = func; } |
259 static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; } | |
257 public: | 260 public: |
258 static int sched_getcpu() { return _sched_getcpu != NULL ? _sched_getcpu() : -1; } | 261 static int sched_getcpu() { return _sched_getcpu != NULL ? _sched_getcpu() : -1; } |
259 static int numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) { | 262 static int numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) { |
260 return _numa_node_to_cpus != NULL ? _numa_node_to_cpus(node, buffer, bufferlen) : -1; | 263 return _numa_node_to_cpus != NULL ? _numa_node_to_cpus(node, buffer, bufferlen) : -1; |
261 } | 264 } |
262 static int numa_max_node() { return _numa_max_node != NULL ? _numa_max_node() : -1; } | 265 static int numa_max_node() { return _numa_max_node != NULL ? _numa_max_node() : -1; } |
263 static int numa_available() { return _numa_available != NULL ? _numa_available() : -1; } | 266 static int numa_available() { return _numa_available != NULL ? _numa_available() : -1; } |
264 static int numa_tonode_memory(void *start, size_t size, int node) { | 267 static int numa_tonode_memory(void *start, size_t size, int node) { |
265 return _numa_tonode_memory != NULL ? _numa_tonode_memory(start, size, node) : -1; | 268 return _numa_tonode_memory != NULL ? _numa_tonode_memory(start, size, node) : -1; |
269 } | |
270 static void numa_interleave_memory(void *start, size_t size) { | |
271 if (_numa_interleave_memory != NULL && _numa_all_nodes != NULL) { | |
272 _numa_interleave_memory(start, size, _numa_all_nodes); | |
273 } | |
266 } | 274 } |
267 static int get_node_by_cpu(int cpu_id); | 275 static int get_node_by_cpu(int cpu_id); |
268 }; | 276 }; |
269 | 277 |
270 | 278 |