Skip to content

Commit 55c6918

Browse files
authored
Merge pull request #5053 from tkordenbrock/topic/master/btl-portals4.del_proc.fix
master: btl-portals4: don't free module resources when proc count goes to zero
2 parents d646a00 + b569633 commit 55c6918

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

opal/mca/btl/portals4/btl_portals4.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,13 @@ mca_btl_portals4_add_procs(struct mca_btl_base_module_t* btl_base,
389389
struct mca_btl_portals4_module_t* portals4_btl = (struct mca_btl_portals4_module_t*) btl_base;
390390
int ret;
391391
size_t i;
392-
bool need_activate = false;
393392

394393
opal_output_verbose(50, opal_btl_base_framework.framework_output,
395394
"mca_btl_portals4_add_procs: Adding %d procs (%d) for NI %d",
396395
(int) nprocs,
397396
(int) portals4_btl->portals_num_procs,
398397
portals4_btl->interface_num);
399398

400-
if (0 == portals4_btl->portals_num_procs) {
401-
need_activate = true;
402-
}
403-
404399
/*
405400
* The PML handed us a list of procs that need Portals4
406401
* peer info. Complete those procs here.
@@ -435,7 +430,7 @@ mca_btl_portals4_add_procs(struct mca_btl_base_module_t* btl_base,
435430
portals4_btl->interface_num));
436431
}
437432

438-
if (need_activate && portals4_btl->portals_num_procs > 0) {
433+
if (mca_btl_portals4_component.need_init && portals4_btl->portals_num_procs > 0) {
439434
if (mca_btl_portals4_component.use_logical) {
440435
ret = create_maptable(portals4_btl, nprocs, procs, btl_peer_data);
441436
if (OPAL_SUCCESS != ret) {
@@ -453,6 +448,7 @@ mca_btl_portals4_add_procs(struct mca_btl_base_module_t* btl_base,
453448
__FILE__, __LINE__, ret);
454449
return ret;
455450
}
451+
mca_btl_portals4_component.need_init = 0;
456452
}
457453

458454
return OPAL_SUCCESS;
@@ -479,9 +475,6 @@ mca_btl_portals4_del_procs(struct mca_btl_base_module_t *btl,
479475
OPAL_THREAD_ADD_FETCH32(&portals4_btl->portals_num_procs, -1);
480476
}
481477

482-
if (0 == portals4_btl->portals_num_procs)
483-
mca_btl_portals4_free_module(portals4_btl);
484-
485478
return OPAL_SUCCESS;
486479
}
487480

0 commit comments

Comments
 (0)