Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @ 391:ab4a7734b9c4
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
author | iveresov |
---|---|
date | Mon, 06 Oct 2008 20:59:16 -0700 |
parents | 06df86c2ec37 |
children | 85f1b9537f70 |
comparison
equal
deleted
inserted
replaced
390:cc68c8e9b309 | 391:ab4a7734b9c4 |
---|---|
389 size_t MutableNUMASpace::default_chunk_size() { | 389 size_t MutableNUMASpace::default_chunk_size() { |
390 return base_space_size() / lgrp_spaces()->length() * page_size(); | 390 return base_space_size() / lgrp_spaces()->length() * page_size(); |
391 } | 391 } |
392 | 392 |
393 // Produce a new chunk size. page_size() aligned. | 393 // Produce a new chunk size. page_size() aligned. |
394 // This function is expected to be called on sequence of i's from 0 to | |
395 // lgrp_spaces()->length(). | |
394 size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) { | 396 size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) { |
395 size_t pages_available = base_space_size(); | 397 size_t pages_available = base_space_size(); |
396 for (int j = 0; j < i; j++) { | 398 for (int j = 0; j < i; j++) { |
397 pages_available -= round_down(current_chunk_size(j), page_size()) / page_size(); | 399 pages_available -= round_down(current_chunk_size(j), page_size()) / page_size(); |
398 } | 400 } |
403 alloc_rate += lgrp_spaces()->at(j)->alloc_rate()->average(); | 405 alloc_rate += lgrp_spaces()->at(j)->alloc_rate()->average(); |
404 } | 406 } |
405 size_t chunk_size = 0; | 407 size_t chunk_size = 0; |
406 if (alloc_rate > 0) { | 408 if (alloc_rate > 0) { |
407 LGRPSpace *ls = lgrp_spaces()->at(i); | 409 LGRPSpace *ls = lgrp_spaces()->at(i); |
408 chunk_size = (size_t)(ls->alloc_rate()->average() * pages_available / alloc_rate) * page_size(); | 410 chunk_size = (size_t)(ls->alloc_rate()->average() / alloc_rate * pages_available) * page_size(); |
409 } | 411 } |
410 chunk_size = MAX2(chunk_size, page_size()); | 412 chunk_size = MAX2(chunk_size, page_size()); |
411 | 413 |
412 if (limit > 0) { | 414 if (limit > 0) { |
413 limit = round_down(limit, page_size()); | 415 limit = round_down(limit, page_size()); |