From d091fd42d4688087a12d89811fe7af69d076a613 Mon Sep 17 00:00:00 2001 From: Seth Zegelstein Date: Mon, 23 Oct 2023 22:38:06 +0000 Subject: [PATCH] prov/shm: Fix revert PR #9377 to revert correct lock I mistakenly reverted the wrong lock on PR#9377, and caused a performance regression. This change makes the ep->lock be domain dependent, and properly revers util_cntr ep_list_lock to always be mutex. This restores most of the performance regression. Signed-off-by: Seth Zegelstein --- prov/util/src/util_cntr.c | 5 +---- prov/util/src/util_ep.c | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/prov/util/src/util_cntr.c b/prov/util/src/util_cntr.c index 4b47624045d..6cafa917600 100644 --- a/prov/util/src/util_cntr.c +++ b/prov/util/src/util_cntr.c @@ -390,10 +390,7 @@ int ofi_cntr_init(const struct fi_provider *prov, struct fid_domain *domain, return ret; } - ofi_genlock_init(&cntr->ep_list_lock, - cntr->domain->threading == FI_THREAD_DOMAIN || - cntr->domain->threading == FI_THREAD_COMPLETION ? - OFI_LOCK_NOOP : OFI_LOCK_MUTEX); + ofi_genlock_init(&cntr->ep_list_lock, OFI_LOCK_MUTEX); ofi_atomic_inc32(&cntr->domain->ref); /* CNTR must be fully operational before adding to wait set */ diff --git a/prov/util/src/util_ep.c b/prov/util/src/util_ep.c index 61906a9f202..a851a12dad3 100644 --- a/prov/util/src/util_ep.c +++ b/prov/util/src/util_ep.c @@ -248,7 +248,9 @@ int ofi_endpoint_init(struct fid_domain *domain, const struct util_prov *util_pr ofi_ep_bind_eq(ep, util_domain->eq); /* TODO Figure out how to optimize this lock for rdm and msg endpoints */ - ret = ofi_genlock_init(&ep->lock, OFI_LOCK_MUTEX); + ret = ofi_genlock_init(&ep->lock, + ep->domain->threading != FI_THREAD_SAFE ? + OFI_LOCK_NOOP : OFI_LOCK_MUTEX); if (ret) return ret;