mcst-linux-kernel/patches-2024.06.26/ucx-1.9.0/0007-Add-src-uct-ib-base-ib...

46 lines
1.4 KiB
Diff

Date: Mon, 21 Oct 2019 02:35:43 +0300
Subject: [PATCH 7/8] Add src/uct/ib/base/ib_md.c mbind aligned patch
function uct_ib_md_reg_mr in old ucx
function uct_ib_reg_mr in ucx-1.8.1
---
src/uct/ib/base/ib_md.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/uct/ib/base/ib_md.c b/src/uct/ib/base/ib_md.c
index b030194..f75f00e 100644
--- a/src/uct/ib/base/ib_md.c
+++ b/src/uct/ib/base/ib_md.c
@@ -27,6 +27,9 @@
#include <sys/resource.h>
#include <float.h>
+// E2K patch
+#include <numa.h>
+#include <numaif.h>
#define UCT_IB_MD_RCACHE_DEFAULT_ALIGN 16
@@ -498,6 +501,21 @@ ucs_status_t uct_ib_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
uint64_t access, struct ibv_mr **mr_p)
{
struct ibv_mr *mr;
+
+// E2K patch
+ {
+ int err;
+ unsigned long nodes = 1; // use node 0 (bitmask of first node)
+ void *address_align = ucs_align_down_pow2_ptr(addr, ucs_get_page_size());
+ size_t length_align = ucs_align_up_pow2(length, ucs_get_page_size());
+ err = mbind(address_align, length_align, MPOL_BIND, &nodes,
+ sizeof(unsigned long)*8, MPOL_MF_MOVE|MPOL_MF_STRICT);
+ if (err < 0) {
+ ucs_error("ib_md.c mbind MF MOVE + MF STRICT (addr %p %p size=%zu %zu) failed: %d %m",
+ addr, address_align, length, length_align, err);
+ }
+ }
+
#if HAVE_DECL_IBV_EXP_REG_MR
struct ibv_exp_reg_mr_in in = {};