OK my last commit was ... kind of wrong. It only worked if the element_size
was smaller than the CACHE_LINE_SIZE. Here is the version that works. In fact this works on 2 steps. First we set the element size to something multiple of the desired alignment. Then when we allocate memory, we compute the total size, and we will align each of the elements (we allocate multiple of them every time) to the CACHE_LINE_SIZE. This commit was SVN r10479.
Этот коммит содержится в:
родитель
c71f6c9765
Коммит
9eb023a5c2
@ -104,10 +104,9 @@ int ompi_free_list_init(
|
||||
int num_elements_per_alloc,
|
||||
mca_mpool_base_module_t* mpool)
|
||||
{
|
||||
if( elem_size % CACHE_LINE_SIZE )
|
||||
flist->fl_elem_size = elem_size;
|
||||
else {
|
||||
flist->fl_elem_size = (elem_size + CACHE_LINE_SIZE) % CACHE_LINE_SIZE;
|
||||
if( elem_size % CACHE_LINE_SIZE ) {
|
||||
flist->fl_elem_size += CACHE_LINE_SIZE - (elem_size % CACHE_LINE_SIZE);
|
||||
}
|
||||
flist->fl_elem_class = elem_class;
|
||||
flist->fl_max_to_alloc = max_elements_to_alloc;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user