opal/common/ucx: use trylock in opal_common_progress
Signed-off-by: Xin Zhao <xinz@mellanox.com>
Этот коммит содержится в:
родитель
2d3cffe1a3
Коммит
1fa7054041
@ -290,24 +290,24 @@ opal_common_ucx_wpool_progress(opal_common_ucx_wpool_t *wpool)
|
|||||||
/* Go over all active workers and progress them
|
/* Go over all active workers and progress them
|
||||||
* TODO: may want to have some partitioning to progress only part of
|
* TODO: may want to have some partitioning to progress only part of
|
||||||
* workers */
|
* workers */
|
||||||
opal_mutex_lock(&wpool->mutex);
|
if (!opal_mutex_trylock (&wpool->mutex)) {
|
||||||
OPAL_LIST_FOREACH_SAFE(item, next, &wpool->active_workers,
|
OPAL_LIST_FOREACH_SAFE(item, next, &wpool->active_workers,
|
||||||
_winfo_list_item_t) {
|
_winfo_list_item_t) {
|
||||||
opal_common_ucx_winfo_t *winfo = item->ptr;
|
opal_common_ucx_winfo_t *winfo = item->ptr;
|
||||||
opal_mutex_lock(&winfo->mutex);
|
opal_mutex_lock(&winfo->mutex);
|
||||||
if( OPAL_UNLIKELY(winfo->released) ) {
|
if( OPAL_UNLIKELY(winfo->released) ) {
|
||||||
/* Do garbage collection of worker info's if needed */
|
/* Do garbage collection of worker info's if needed */
|
||||||
opal_list_remove_item(&wpool->active_workers, &item->super);
|
opal_list_remove_item(&wpool->active_workers, &item->super);
|
||||||
_winfo_reset(winfo);
|
_winfo_reset(winfo);
|
||||||
opal_list_append(&wpool->idle_workers, &item->super);
|
opal_list_append(&wpool->idle_workers, &item->super);
|
||||||
} else {
|
} else {
|
||||||
/* Progress worker until there are existing events */
|
/* Progress worker until there are existing events */
|
||||||
while(ucp_worker_progress(winfo->worker));
|
while(ucp_worker_progress(winfo->worker));
|
||||||
|
}
|
||||||
|
opal_mutex_unlock(&winfo->mutex);
|
||||||
}
|
}
|
||||||
opal_mutex_unlock(&winfo->mutex);
|
opal_mutex_unlock(&wpool->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
opal_mutex_unlock(&wpool->mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user