12
12
* All rights reserved.
13
13
* Copyright (c) 2006-2007 Voltaire. All rights reserved.
14
14
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
15
- * Copyright (c) 2010-2015 Los Alamos National Security, LLC. All rights
15
+ * Copyright (c) 2010-2016 Los Alamos National Security, LLC. All rights
16
16
* reserved.
17
17
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
18
18
* Copyright (c) 2014-2015 Research Organization for Information Science
@@ -528,6 +528,17 @@ static void mca_btl_vader_endpoint_constructor (mca_btl_vader_endpoint_t *ep)
528
528
ep -> fifo = NULL ;
529
529
}
530
530
531
+ #if OPAL_BTL_VADER_HAVE_XPMEM
532
+ static int mca_btl_vader_endpoint_rcache_cleanup (mca_mpool_base_registration_t * reg , void * ctx )
533
+ {
534
+ struct mca_rcache_base_module_t * rcache = (struct mca_rcache_base_module_t * ) ctx ;
535
+ /* otherwise dereg will fail on assert */
536
+ reg -> ref_count = 0 ;
537
+ (void ) rcache -> rcache_delete (rcache , reg );
538
+ return OPAL_SUCCESS ;
539
+ }
540
+ #endif
541
+
531
542
static void mca_btl_vader_endpoint_destructor (mca_btl_vader_endpoint_t * ep )
532
543
{
533
544
OBJ_DESTRUCT (& ep -> pending_frags );
@@ -537,21 +548,10 @@ static void mca_btl_vader_endpoint_destructor (mca_btl_vader_endpoint_t *ep)
537
548
if (MCA_BTL_VADER_XPMEM == mca_btl_vader_component .single_copy_mechanism ) {
538
549
if (ep -> segment_data .xpmem .rcache ) {
539
550
/* clean out the registration cache */
540
- const int nregs = 100 ;
541
- mca_mpool_base_registration_t * regs [nregs ];
542
- int reg_cnt ;
543
-
544
- do {
545
- reg_cnt = ep -> segment_data .xpmem .rcache -> rcache_find_all (ep -> segment_data .xpmem .rcache , 0 , (size_t )-1 ,
546
- regs , nregs );
547
-
548
- for (int i = 0 ; i < reg_cnt ; ++ i ) {
549
- /* otherwise dereg will fail on assert */
550
- regs [i ]-> ref_count = 0 ;
551
- OBJ_RELEASE (regs [i ]);
552
- }
553
- } while (reg_cnt == nregs );
554
-
551
+ (void ) ep -> segment_data .xpmem .rcache -> rcache_iterate (ep -> segment_data .xpmem .rcache ,
552
+ NULL , (size_t ) -1 ,
553
+ mca_btl_vader_endpoint_rcache_cleanup ,
554
+ (void * ) ep -> segment_data .xpmem .rcache );
555
555
ep -> segment_data .xpmem .rcache = NULL ;
556
556
}
557
557
0 commit comments