diff --git a/0001-util-mr_cache-Implement-new-MR-caching-path-w-o-merg.patch b/0001-util-mr_cache-Implement-new-MR-caching-path-w-o-merg.patch new file mode 100644 index 0000000000000000000000000000000000000000..b8154feb483a0b409533c702c0a58a289fa74f0a --- /dev/null +++ b/0001-util-mr_cache-Implement-new-MR-caching-path-w-o-merg.patch @@ -0,0 +1,94 @@ +From 6e3cbac77fb00f29176f3e29e07d3579ad9e125a Mon Sep 17 00:00:00 2001 +From: Dmitry Gladkov +Date: Thu, 29 Mar 2018 16:34:36 +0300 +Subject: [PATCH] util/mr_cache: Implement new MR caching path w/o merging + regions + +Signed-off-by: Dmitry Gladkov +--- + include/ofi_iov.h | 14 ++++++++++++++ + include/ofi_mr.h | 1 + + prov/util/src/util_mr_cache.c | 16 +++++++++++++++- + 3 files changed, 30 insertions(+), 1 deletion(-) + +diff --git a/include/ofi_iov.h b/include/ofi_iov.h +index bcc86fc98..dbf4b377d 100644 +--- a/include/ofi_iov.h ++++ b/include/ofi_iov.h +@@ -117,6 +117,20 @@ ofi_iov_right(const struct iovec *iov1, const struct iovec *iov2) + return iov1->iov_base > ofi_iov_end(iov2); + } + ++static inline bool ++ofi_iov_shifted_left(const struct iovec *iov1, const struct iovec *iov2) ++{ ++ return ((iov1->iov_base < iov2->iov_base) && ++ (ofi_iov_end(iov1) < ofi_iov_end(iov2))); ++} ++ ++static inline bool ++ofi_iov_shifted_right(const struct iovec *iov1, const struct iovec *iov2) ++{ ++ return ((iov1->iov_base > iov2->iov_base) && ++ (ofi_iov_end(iov1) > ofi_iov_end(iov2))); ++} ++ + static inline bool + ofi_iov_within(const struct iovec *iov1, const struct iovec *iov2) + { +diff --git a/include/ofi_mr.h b/include/ofi_mr.h +index a3f23dd6e..05c156871 100644 +--- a/include/ofi_mr.h ++++ b/include/ofi_mr.h +@@ -186,6 +186,7 @@ struct ofi_mr_cache { + struct ofi_notification_queue nq; + size_t max_cached_cnt; + size_t max_cached_size; ++ int merge_regions; + size_t entry_data_size; + + RbtHandle mr_tree; +diff --git a/prov/util/src/util_mr_cache.c b/prov/util/src/util_mr_cache.c +index c1b2e9956..6a74ff491 100644 +--- a/prov/util/src/util_mr_cache.c ++++ b/prov/util/src/util_mr_cache.c +@@ -38,6 +38,17 @@ + #include + #include + ++static int util_mr_find_within(void *a, void *b) ++{ ++ struct iovec *iov1 = a, *iov2 = b; ++ ++ if (ofi_iov_shifted_left(iov1, iov2)) ++ return -1; ++ else if (ofi_iov_shifted_right(iov1, iov2)) ++ return 1; ++ else ++ return 0; ++} + + static int util_mr_find_overlap(void *a, void *b) + { +@@ -252,6 +263,7 @@ int ofi_mr_cache_search(struct ofi_mr_cache *cache, const struct fi_mr_attr *att + + rbtKeyValue(cache->mr_tree, iter, (void **) &iov, (void **) entry); + ++ /* This branch is always false if the merging entries wasn't requested */ + if (!ofi_iov_within(attr->mr_iov, iov)) + return util_mr_cache_merge(cache, attr, iter, entry); + +@@ -292,7 +304,9 @@ int ofi_mr_cache_init(struct util_domain *domain, struct ofi_mem_monitor *monito + { + assert(cache->add_region && cache->delete_region); + +- cache->mr_tree = rbtNew(util_mr_find_overlap); ++ cache->mr_tree = rbtNew(cache->merge_regions ? ++ util_mr_find_overlap : ++ util_mr_find_within); + if (!cache->mr_tree) + return -FI_ENOMEM; + +-- +2.42.0.windows.2 + diff --git a/libfabric.spec b/libfabric.spec index 03c13a49759e47166b79339d5130f4d629049553..26f7ff14ecec3c050dc589cdcc58cb5ba3039aee 100644 --- a/libfabric.spec +++ b/libfabric.spec @@ -1,12 +1,12 @@ Name: libfabric Version: 1.6.1 -Release: 4 +Release: 5 Summary: A core component of OpenFabric Interfaces License: BSD or GPLv2 URL: http://ofiwg.github.io/libfabric/ Source0: https://github.com/ofiwg/libfabric/releases/download/v%{version}/%{name}-%{version}.tar.bz2 Patch0001: backport-libfabric-fix-multiple-definition.patch - +Patch0002: 0001-util-mr_cache-Implement-new-MR-caching-path-w-o-merg.patch BuildRequires: gcc libibverbs-devel libnl3-devel librdmacm-devel %ifarch x86_64 @@ -76,6 +76,9 @@ This contains man files for the using of libfabric. %changelog +* Thu Oct 19 2023 liubo - 1.6.1-5 +- util/mr_cache: Implement new MR caching path w/o merging + * Wed Aug 04 2021 Liu Yinsi - 1.6.1-4 - fix multiple definition to support gcc 10