@@ -101,17 +101,26 @@ void *mca_smsc_xpmem_map_peer_region(mca_smsc_endpoint_t *endpoint, uint64_t fla
101101 * does not fully cover it, we destroy it and make in its place a new one
102102 * that covers both the existing and the new range. */
103103
104- /* The search settings below will also match areas that would be right next to
105- * the new one (technically not overlapping, but uniteable under a single area).
106- * Whether we want this is debatable (re-establishing an XPMEM attachment can
107- * incur significant overhead). The current choice matches legacy behaviour. */
108-
109- // Ideally, we would want a find() method capable of partial matching
110- uintptr_t search_base [] = {base , bound , base - 1 , bound + 1 };
111- for (size_t i = 0 ; i < sizeof (search_base )/sizeof (search_base [0 ]); i ++ ) {
104+ /* The search settings below will also match areas that would be right next to the
105+ * new one, which aren't technically overlapping, but are uniteable under a single
106+ * area. Whether we want this is debatable, as re-establishing an XPMEM attachment
107+ * can incur significant overhead. The current choice matches legacy behaviour. */
108+
109+ /* Ideally, we would want a find() method capable of partial matching */
110+
111+ uintptr_t find_base [4 ] = {base , bound };
112+ int n_find_bases = 2 ;
113+ if (base > 0 ) {
114+ find_base [n_find_bases ++ ] = base - 1 ;
115+ }
116+ if (bound < (uintptr_t ) -1 ) {
117+ find_base [n_find_bases ++ ] = bound + 1 ;
118+ }
119+
120+ for (int i = 0 ; i < n_find_bases ; i ++ ) {
112121 mca_rcache_base_registration_t * ov_reg = NULL ;
113122
114- rc = mca_rcache_base_vma_find (vma_module , (void * ) search_base [i ], 1 , & ov_reg );
123+ rc = mca_rcache_base_vma_find (vma_module , (void * ) find_base [i ], 1 , & ov_reg );
115124 assert (OPAL_SUCCESS == rc );
116125
117126 if (ov_reg ) {
0 commit comments