Commit c07eeba4 authored by Xin Zhao's avatar Xin Zhao
Browse files

Add check no_locks info in set_info function.

If user set no_locks to true, we do not need
to allocate passive lock requests pool and
lock data pool on window.

No reviewer.
parent 7b537b01
......@@ -293,6 +293,23 @@ int MPIDI_Win_set_info(MPID_Win *win, MPID_Info *info)
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_WIN_SET_INFO);
/********************************************************/
/************** check for info no_locks *****************/
/********************************************************/
if (info != NULL) {
int info_flag = 0;
char info_value[MPI_MAX_INFO_VAL+1];
MPIR_Info_get_impl(info, "no_locks", MPI_MAX_INFO_VAL,
info_value, &info_flag);
if (info_flag) {
if (!strncmp(info_value, "true", strlen("true")))
win->info_args.no_locks = 1;
if (!strncmp(info_value, "false", strlen("true")))
win->info_args.no_locks = 1;
}
}
/********************************************************/
/*************** check for info alloc_shm ***************/
/********************************************************/
......
......@@ -372,8 +372,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
(*win_ptr)->slots[i].target_list_tail = NULL;
}
/* FIXME: we can optimize by letting the user to pass WIN INFO hint if they will not use passive target,
in such case we do not need to allocate window pool for lock entries. */
if (!(*win_ptr)->info_args.no_locks) {
MPIU_CHKPMEM_MALLOC((*win_ptr)->lock_entry_pool_start, MPIDI_RMA_Lock_entry_t *,
sizeof(MPIDI_RMA_Lock_entry_t) * MPIR_CVAR_CH3_RMA_LOCK_ENTRY_WIN_POOL_SIZE,
mpi_errno, "RMA lock entry pool");
......@@ -383,6 +382,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
MPL_LL_APPEND((*win_ptr)->lock_entry_pool, (*win_ptr)->lock_entry_pool_tail,
&((*win_ptr)->lock_entry_pool_start[i]));
}
}
/* enqueue window into the global list */
MPIU_CHKPMEM_MALLOC(win_elem, MPIDI_RMA_Win_list_t *, sizeof(MPIDI_RMA_Win_list_t), mpi_errno,
......
......@@ -239,7 +239,9 @@ int MPIDI_Win_free(MPID_Win ** win_ptr)
MPIU_Free((*win_ptr)->op_pool_start);
MPIU_Free((*win_ptr)->target_pool_start);
MPIU_Free((*win_ptr)->slots);
if (!(*win_ptr)->info_args.no_locks) {
MPIU_Free((*win_ptr)->lock_entry_pool_start);
}
MPIU_Assert((*win_ptr)->current_lock_data_bytes == 0);
/* Free the attached buffer for windows created with MPI_Win_allocate() */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment