diff --git a/lib/path.c b/lib/path.c index 2878b5100..79fb07aa9 100644 --- a/lib/path.c +++ b/lib/path.c @@ -45,8 +45,9 @@ static void path_destination_enqueue(struct path *p, struct sample *smps[], unsi static int path_source_init(struct path_source *ps) { int ret; + unsigned pool_cnt = (strcmp(node_type_name(ps->node->_vt), "infiniband") == 0 ? 8192 : (unsigned) MAX(DEFAULT_QUEUELEN, ps->node->in.vectorize)); - ret = pool_init(&ps->pool, MAX(DEFAULT_QUEUELEN, ps->node->in.vectorize), SAMPLE_LEN(ps->node->samplelen), &memory_hugepage); + ret = pool_init(&ps->pool, pool_cnt, SAMPLE_LEN(ps->node->samplelen), node_memory_type(ps->node, &memory_hugepage)); if (ret) return ret; @@ -394,9 +395,17 @@ int path_init2(struct path *p) #endif /* WITH_HOOKS */ /* Initialize destinations */ + struct memory_type *pool_mem_type = &memory_hugepage; + unsigned pool_cnt = (unsigned) MAX(1, list_length(&p->destinations) * p->queuelen); + for (size_t i = 0; i < list_length(&p->destinations); i++) { struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i); + if (strcmp(node_type_name(pd->node->_vt), "infiniband") == 0) { + pool_cnt = 8192; + pool_mem_type = node_memory_type(pd->node, &memory_hugepage); + } + ret = path_destination_init(pd, p->queuelen); if (ret) return ret; @@ -416,6 +425,7 @@ int path_init2(struct path *p) /* Calc sample length of path and initialize bitset */ p->samplelen = 0; + for (size_t i = 0; i < list_length(&p->sources); i++) { struct path_source *ps = (struct path_source *) list_at(&p->sources, i); @@ -436,7 +446,7 @@ int path_init2(struct path *p) if (!p->samplelen) p->samplelen = DEFAULT_SAMPLELEN; - ret = pool_init(&p->pool, MAX(1, list_length(&p->destinations)) * p->queuelen, SAMPLE_LEN(p->samplelen), &memory_hugepage); + ret = pool_init(&p->pool, pool_cnt, SAMPLE_LEN(p->samplelen), pool_mem_type); if (ret) return ret;