提交 b3b6893b 编写于 作者: I iveresov

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
上级 b95aca5c
...@@ -391,6 +391,8 @@ size_t MutableNUMASpace::default_chunk_size() { ...@@ -391,6 +391,8 @@ size_t MutableNUMASpace::default_chunk_size() {
} }
// Produce a new chunk size. page_size() aligned. // 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 MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) {
size_t pages_available = base_space_size(); size_t pages_available = base_space_size();
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
...@@ -405,7 +407,7 @@ size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) { ...@@ -405,7 +407,7 @@ size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) {
size_t chunk_size = 0; size_t chunk_size = 0;
if (alloc_rate > 0) { if (alloc_rate > 0) {
LGRPSpace *ls = lgrp_spaces()->at(i); 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()); chunk_size = MAX2(chunk_size, page_size());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册