Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @ 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 | ab4a7734b9c4 |
children | 7d7a7c599c17 |
comparison
equal
deleted
inserted
replaced
457:27a80744a83b | 462:85f1b9537f70 |
---|---|
412 chunk_size = MAX2(chunk_size, page_size()); | 412 chunk_size = MAX2(chunk_size, page_size()); |
413 | 413 |
414 if (limit > 0) { | 414 if (limit > 0) { |
415 limit = round_down(limit, page_size()); | 415 limit = round_down(limit, page_size()); |
416 if (chunk_size > current_chunk_size(i)) { | 416 if (chunk_size > current_chunk_size(i)) { |
417 chunk_size = MIN2((off_t)chunk_size, (off_t)current_chunk_size(i) + (off_t)limit); | 417 size_t upper_bound = pages_available * page_size(); |
418 if (upper_bound > limit && | |
419 current_chunk_size(i) < upper_bound - limit) { | |
420 // The resulting upper bound should not exceed the available | |
421 // amount of memory (pages_available * page_size()). | |
422 upper_bound = current_chunk_size(i) + limit; | |
423 } | |
424 chunk_size = MIN2(chunk_size, upper_bound); | |
418 } else { | 425 } else { |
419 chunk_size = MAX2((off_t)chunk_size, (off_t)current_chunk_size(i) - (off_t)limit); | 426 size_t lower_bound = page_size(); |
427 if (current_chunk_size(i) > limit) { // lower_bound shouldn't underflow. | |
428 lower_bound = current_chunk_size(i) - limit; | |
429 } | |
430 chunk_size = MAX2(chunk_size, lower_bound); | |
420 } | 431 } |
421 } | 432 } |
422 assert(chunk_size <= pages_available * page_size(), "Chunk size out of range"); | 433 assert(chunk_size <= pages_available * page_size(), "Chunk size out of range"); |
423 return chunk_size; | 434 return chunk_size; |
424 } | 435 } |