Skip to content

Commit 88bb483

Browse files
committed
Refactor smsc/xpmem reg cache to use find() instead of iterate()
Signed-off-by: George Katevenis <[email protected]>
1 parent 4b39d07 commit 88bb483

File tree

4 files changed

+168
-134
lines changed

4 files changed

+168
-134
lines changed

opal/mca/btl/sm/btl_sm_component.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* Copyright (c) 2019-2021 Google, Inc. All rights reserved.
2525
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
2626
* Copyright (c) 2022 IBM Corporation. All rights reserved.
27+
* Copyright (c) 2022 Computer Architecture and VLSI Systems (CARV)
28+
* Laboratory, ICS Forth. All rights reserved.
2729
* $COPYRIGHT$
2830
*
2931
* Additional copyrights may follow
@@ -437,9 +439,9 @@ void mca_btl_sm_poll_handle_frag(mca_btl_sm_hdr_t *hdr, struct mca_btl_base_endp
437439
.cbdata = reg->cbdata};
438440

439441
if (hdr->flags & MCA_BTL_SM_FLAG_SINGLE_COPY) {
440-
void *ctx = MCA_SMSC_CALL(map_peer_region, endpoint->smsc_endpoint, /*flags=*/0,
441-
hdr->sc_iov.iov_base, hdr->sc_iov.iov_len,
442-
&segments[1].seg_addr.pval);
442+
void *ctx = MCA_SMSC_CALL(map_peer_region, endpoint->smsc_endpoint,
443+
MCA_RCACHE_FLAGS_PERSIST, hdr->sc_iov.iov_base,
444+
hdr->sc_iov.iov_len, &segments[1].seg_addr.pval);
443445
assert(NULL != ctx);
444446

445447
segments[1].seg_len = hdr->sc_iov.iov_len;

opal/mca/smsc/xpmem/smsc_xpmem_component.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2021 Google, Inc. All rights reserved.
4+
* Copyright (c) 2022 Computer Architecture and VLSI Systems (CARV)
5+
* Laboratory, ICS Forth. All rights reserved.
46
* $COPYRIGHT$
57
*
68
* Additional copyrights may follow
@@ -76,10 +78,7 @@ static int mca_smsc_xpmem_component_open(void)
7678

7779
static int mca_smsc_xpmem_component_close(void)
7880
{
79-
if (mca_smsc_xpmem_module.vma_module) {
80-
OBJ_RELEASE(mca_smsc_xpmem_module.vma_module);
81-
}
82-
81+
/* nothing to do */
8382
return OPAL_SUCCESS;
8483
}
8584

@@ -161,7 +160,5 @@ static mca_smsc_module_t *mca_smsc_xpmem_component_enable(void)
161160
mca_smsc_xpmem_component.log_attach_align
162161
= opal_min(opal_max(mca_smsc_xpmem_component.log_attach_align, 12), 25);
163162

164-
mca_smsc_xpmem_module.vma_module = mca_rcache_base_vma_module_alloc();
165-
166163
return &mca_smsc_xpmem_module.super;
167164
}

opal/mca/smsc/xpmem/smsc_xpmem_internal.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2021 Google, Inc. All rights reserved.
4+
* Copyright (c) 2022 Computer Architecture and VLSI Systems (CARV)
5+
* Laboratory, ICS Forth. All rights reserved.
46
* $COPYRIGHT$
57
*
68
* Additional copyrights may follow
@@ -12,6 +14,7 @@
1214
#define OPAL_MCA_SMSC_XPMEM_SMSC_XPMEM_INTERNAL_H
1315

1416
#include "opal/mca/smsc/xpmem/smsc_xpmem.h"
17+
#include "opal/mca/rcache/rcache.h"
1518

1619
#include "opal/mca/rcache/base/rcache_base_vma.h"
1720
#if defined(HAVE_XPMEM_H)
@@ -42,6 +45,8 @@ struct mca_smsc_xpmem_endpoint_t {
4245
xpmem_apid_t apid;
4346
/** maximum address we can attach to on this peer */
4447
uintptr_t address_max;
48+
/** cache of xpmem attachments created using this endpoint */
49+
mca_rcache_base_vma_module_t *vma_module;
4550
};
4651

4752
typedef struct mca_smsc_xpmem_endpoint_t mca_smsc_xpmem_endpoint_t;
@@ -67,10 +72,6 @@ typedef struct mca_smsc_xpmem_component_t mca_smsc_xpmem_component_t;
6772

6873
struct mca_smsc_xpmem_module_t {
6974
mca_smsc_module_t super;
70-
71-
/** cache of xpmem attachments. this cache holds attachments for all peers. the registrations
72-
* are differentiated by the alloc_base which is set to the endpoint. */
73-
mca_rcache_base_vma_module_t *vma_module;
7475
};
7576

7677
typedef struct mca_smsc_xpmem_module_t mca_smsc_xpmem_module_t;

0 commit comments

Comments
 (0)