--- opal/class/opal_free_list.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --quilt old/opal/class/opal_free_list.c new/opal/class/opal_free_list.c --- old/opal/class/opal_free_list.c +++ new/opal/class/opal_free_list.c @@ -22,23 +22,25 @@ #include "opal/sys/cache.h" static void opal_free_list_construct(opal_free_list_t* fl); static void opal_free_list_destruct(opal_free_list_t* fl); +static void opal_free_list_cache_construct(opal_free_list_t* fl); +static void opal_free_list_cache_destruct(opal_free_list_t* fl); -OBJ_CLASS_INSTANCE(opal_free_list_t, - opal_list_t, - opal_free_list_construct, - opal_free_list_destruct); +OBJ_CLASS_INSTANCE_CACHE(opal_free_list_t, + opal_list_t, + opal_free_list_construct, + opal_free_list_destruct, + opal_free_list_cache_construct, + opal_free_list_cache_destruct); OBJ_CLASS_INSTANCE(opal_free_list_item_t, opal_list_item_t, NULL, NULL); static void opal_free_list_construct(opal_free_list_t* fl) { - OBJ_CONSTRUCT(&fl->fl_lock, opal_mutex_t); - OBJ_CONSTRUCT(&fl->fl_condition, opal_condition_t); fl->fl_max_to_alloc = 0; fl->fl_num_allocated = 0; fl->fl_num_per_alloc = 0; fl->fl_num_waiting = 0; fl->fl_elem_size = 0; @@ -55,10 +57,20 @@ static void opal_free_list_destruct(opal OBJ_DESTRUCT(item); free(item); } OBJ_DESTRUCT(&fl->fl_allocations); +} + +static void opal_free_list_cache_construct(opal_free_list_t* fl) +{ + OBJ_CONSTRUCT(&fl->fl_lock, opal_mutex_t); + OBJ_CONSTRUCT(&fl->fl_condition, opal_condition_t); +} + +static void opal_free_list_cache_destruct(opal_free_list_t* fl) +{ OBJ_DESTRUCT(&fl->fl_condition); OBJ_DESTRUCT(&fl->fl_lock); } int opal_free_list_init(