Skip to content

Commit 4459e45

Browse files
committed
osc/rdma: fix bug in dynamic memory window tracking code
This commit fixes an ordering bug in the code that keeps track of all attached memory windows. The code is intended to keep the memory regions sorted but was often inserting at the wrong index. Thanks to Christoph Niethammer for reporting the issue. The reproducer will be added to nightly MTT testing. Fixes #2012 Signed-off-by: Nathan Hjelm <[email protected]>
1 parent e4df05d commit 4459e45

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ompi/mca/osc/rdma/osc_rdma_dynamic.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
3+
* Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
44
* reserved.
55
* $COPYRIGHT$
66
*
@@ -14,6 +14,7 @@
1414

1515
#include "mpi.h"
1616

17+
#include "opal/util/sys_limits.h"
1718

1819
/**
1920
* ompi_osc_rdma_find_region_containing:
@@ -71,9 +72,11 @@ static ompi_osc_rdma_region_t *find_insertion_point (ompi_osc_rdma_region_t *reg
7172
int mid_index = (max_index + min_index) >> 1;
7273
ompi_osc_rdma_region_t *region = (ompi_osc_rdma_region_t *)((intptr_t) regions + mid_index * region_size);
7374

75+
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "find_insertion_point (%d, %d, %lx, %lu)\n", min_index, max_index, base, region_size);
76+
7477
if (max_index < min_index) {
75-
*region_index = mid_index;
76-
return region;
78+
*region_index = min_index;
79+
return (ompi_osc_rdma_region_t *)((intptr_t) regions + min_index * region_size);
7780
}
7881

7982
if (region->base > base) {
@@ -92,7 +95,7 @@ int ompi_osc_rdma_attach (struct ompi_win_t *win, void *base, size_t len)
9295
osc_rdma_counter_t region_count;
9396
osc_rdma_counter_t region_id;
9497
void *bound;
95-
intptr_t page_size = getpagesize ();
98+
intptr_t page_size = opal_getpagesize ();
9699
int region_index;
97100
int ret;
98101

0 commit comments

Comments
 (0)