6753547: NUMA allocator: Invalid chunk size computation during adaptive resizing
authoriveresov
Mon Oct 06 20:59:16 2008 -0700 (17 months ago)
changeset 376ab4a7734b9c4
parent 375cc68c8e9b309
child 38705366dad12cf
6753547: NUMA allocator: Invalid chunk size computation during adaptive resizing
Summary: The per-lgrp chuck size can be incorrectly computed (causing an assertion failure) because of the non-associativity of the floating point operations. The fix is to rearrange the operations.
Reviewed-by: ysr
src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
--- a/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Mon Oct 06 13:16:35 2008 -0400
+++ b/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Mon Oct 06 20:59:16 2008 -0700
@@ -391,6 +391,8 @@ size_t MutableNUMASpace::default_chunk_s
}
// Produce a new chunk size. page_size() aligned.
+// This function is expected to be called on sequence of i's from 0 to
+// lgrp_spaces()->length().
size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) {
size_t pages_available = base_space_size();
for (int j = 0; j < i; j++) {
@@ -405,7 +407,7 @@ size_t MutableNUMASpace::adaptive_chunk_
size_t chunk_size = 0;
if (alloc_rate > 0) {
LGRPSpace *ls = lgrp_spaces()->at(i);
- chunk_size = (size_t)(ls->alloc_rate()->average() * pages_available / alloc_rate) * page_size();
+ chunk_size = (size_t)(ls->alloc_rate()->average() / alloc_rate * pages_available) * page_size();
}
chunk_size = MAX2(chunk_size, page_size());