parsec icon indicating copy to clipboard operation
parsec copied to clipboard

Data and Data Copy object pool LIFOs underused

Open omor1 opened this issue 2 years ago • 0 comments

Describe the bug

In data.c, when allocating new parsec_data_t * and parsec_data_copy_t * instances (via parsec_data_new and parsec_data_copy_new, respectively), LIFOs are used as a sort of object pool. These LIFOs are parsec_data_lifo and parsec_data_copies_lifo.

The pseudocode for the new functions is:

object_t* new(void)
{
    object_t* item = (object_t*)parsec_lifo_pop(&object_lifo);
    if( NULL == item) {
        item = PARSEC_OBJ_NEW(object_t);
    } else {
        PARSEC_OBJ_CONSTRUCT(item, object_t);
    }
    return item;
}

The problem is that nothing is ever pushed to parsec_data_lifo and parsec_data_copies_lifo; in fact, there is no use of parsec_data_copies_lifo outside of its initialization and deinitialization and in parsec_data_copy_new. parsec_data_delete does push to parsec_data_lifo, but I have identified no uses of this function in the codebase; parsec_data_destroy is used instead, which ignores parsec_data_lifo.

In essence, these LIFOs are not being used for their intended purpose. They should either be removed if they are not necessary or their functionality restored.

Additional context

I was investigating issues where calls to remote_dep_copy_allocate (which calls parsec_arena_get_copy and whence parsec_data_new and parsec_data_copy_new) takes an inordinate amount of time, 100ms or more. My current hypothesis is high contention on shared data structures—of which these LIFOs are one such possibility.

omor1 avatar May 03 '22 20:05 omor1