Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Gleb Natapov (glebn_at_[hidden])
Date: 2005-10-27 06:54:20


Hello,

Current ompi_free_list_grow implementation can fail before
max_elements_to_alloc is reached. This cause deadlock for me
sometimes. Included patch fix this.

Index: ompi/class/ompi_free_list.c
===================================================================
--- ompi/class/ompi_free_list.c (revision 7878)
+++ ompi/class/ompi_free_list.c (working copy)
@@ -104,9 +104,13 @@
     size_t mod;
     mca_mpool_base_registration_t* user_out = NULL;
 
- if (flist->fl_max_to_alloc > 0 && flist->fl_num_allocated + num_elements > flist->fl_max_to_alloc)
- return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
+ if (flist->fl_max_to_alloc > 0)
+ if (flist->fl_num_allocated + num_elements > flist->fl_max_to_alloc)
+ num_elements = flist->fl_max_to_alloc - flist->fl_num_allocated;
 
+ if (num_elements == 0)
+ return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
+
     if (NULL != flist->fl_mpool)
         alloc_ptr = flist->fl_mpool->mpool_alloc(flist->fl_mpool,
                                                  (num_elements * flist->fl_elem_size) + CACHE_LINE_SIZE + sizeof(ompi_free_list_memory_t),

--
			Gleb.