]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async/rdma: export RDMAV_HUGEPAGES_SAFE before ibv_fork_init
authorChangcheng Liu <changcheng.liu@aliyun.com>
Mon, 3 Jun 2019 05:31:09 +0000 (13:31 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 23 Aug 2019 02:45:05 +0000 (10:45 +0800)
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 <changcheng.liu@aliyun.com>
src/msg/async/rdma/Infiniband.cc

index 14f05134d1a0930a6a2845ad1a9053a9ad71f1f5..1fab149aa45f30711790e3c522d84c4b3eb65bce 100644 (file)
@@ -854,14 +854,7 @@ int Infiniband::MemoryManager::get_send_buffers(std::vector<Chunk*> &c, size_t b
 static std::atomic<bool> 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);