From b2d3f5e0970a4afbb82676af9e5b9a12f62a7747 Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Mon, 3 Jun 2019 13:31:09 +0800 Subject: [PATCH] msg/async/rdma: export RDMAV_HUGEPAGES_SAFE before ibv_fork_init In rdma-core library, ibv_fork_init will check environment variable RDMAV_HUGEPAGES_SAFE to decide whether huge page is usable in system. It doesn't make sense to export RDMAV_HUGEPAGES_SAFE env after calling ibv_fork_init. Signed-off-by: Changcheng Liu --- src/msg/async/rdma/Infiniband.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/msg/async/rdma/Infiniband.cc b/src/msg/async/rdma/Infiniband.cc index 14f05134d1a09..1fab149aa45f3 100644 --- a/src/msg/async/rdma/Infiniband.cc +++ b/src/msg/async/rdma/Infiniband.cc @@ -854,14 +854,7 @@ int Infiniband::MemoryManager::get_send_buffers(std::vector &c, size_t b static std::atomic init_prereq = {false}; void Infiniband::verify_prereq(CephContext *cct) { - - //On RDMA MUST be called before fork - int rc = ibv_fork_init(); - if (rc) { - lderr(cct) << __func__ << " failed to call ibv_for_init(). On RDMA must be called before fork. Application aborts." << dendl; - ceph_abort(); - } - + int rc = 0; ldout(cct, 20) << __func__ << " ms_async_rdma_enable_hugepage value is: " << cct->_conf->ms_async_rdma_enable_hugepage << dendl; if (cct->_conf->ms_async_rdma_enable_hugepage){ rc = setenv("RDMAV_HUGEPAGES_SAFE","1",1); @@ -872,6 +865,13 @@ void Infiniband::verify_prereq(CephContext *cct) { } } + //On RDMA MUST be called before fork + rc = ibv_fork_init(); + if (rc) { + lderr(cct) << __func__ << " failed to call ibv_for_init(). On RDMA must be called before fork. Application aborts." << dendl; + ceph_abort(); + } + //Check ulimit struct rlimit limit; getrlimit(RLIMIT_MEMLOCK, &limit); -- 2.39.5