Commit 9fb93538 authored by David Goodell's avatar David Goodell
Browse files

[svn-r6913] update MSGQUEUE CS impl, remove stale BRIEF_GLOBAL references

No reviewer.
parent b2907abd
......@@ -52,6 +52,7 @@ enum MPIU_Thread_cs_name {
MPIU_THREAD_CS_NAME_MPIDCOMM,
MPIU_THREAD_CS_NAME_PMI,
MPIU_THREAD_CS_NAME_CONTEXTID,
MPIU_THREAD_CS_NAME_MSGQUEUE,
/* FIXME device-specific, should this live here? */
/*
MPIU_THREAD_CS_NAME_CH3COMM,
......@@ -82,6 +83,10 @@ typedef struct MPICH_ThreadInfo_t {
MPID_Thread_mutex_t handle_mutex;
#endif
#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
MPID_Thread_mutex_t msgq_mutex;
#endif
#if (MPICH_THREAD_LEVEL >= MPI_THREAD_SERIALIZED)
MPID_Thread_mutex_t memalloc_mutex; /* for MPIU_{Malloc,Free,Calloc} */
#endif
......@@ -599,6 +604,7 @@ M*/
enum MPIU_Nest_mutexes {
MPIU_Nest_global_mutex = 0,
MPIU_Nest_handle_mutex,
MPIU_Nest_msgq_mutex,
MPIU_Nest_NUM_MUTEXES
};
......@@ -725,6 +731,17 @@ enum MPIU_Nest_mutexes {
} while (0); \
MPIU_THREAD_CHECK_END
#define MPIU_THREAD_CS_ENTER_MSGQUEUE(context_) \
do { \
MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(msgq_mutex) \
MPIU_THREAD_CS_ASSERT_ENTER_HELPER(MSGQUEUE); \
} while (0)
#define MPIU_THREAD_CS_EXIT_MSGQUEUE(context_) \
do { \
MPIU_THREAD_CS_ASSERT_EXIT_HELPER(MSGQUEUE); \
MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(msgq_mutex) \
} while (0)
/* change to 0 to enable some iffy CS assert_held logic */
#if 1
#define MPIU_THREAD_CS_ASSERT_HELD(name_) do{/*nothing for now */}while(0)
......@@ -757,8 +774,6 @@ enum MPIU_Nest_mutexes {
} while (0)
#endif
#define MPIU_THREAD_CS_ENTER_MSGQUEUE(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(global_mutex)
#define MPIU_THREAD_CS_EXIT_MSGQUEUE(_context) MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(global_mutex)
/* MT FIXME should all of these CS types share the global_mutex? If yes, how do
* we avoid accidental deadlock? If not, we probably risk inconsistent locking
* schemes, leading to races. */
......
......@@ -148,13 +148,11 @@ static int MPIR_Thread_CS_Init( void )
MPID_Thread_mutex_create(&MPIR_ThreadInfo.global_mutex, NULL);
MPID_Thread_mutex_create(&MPIR_ThreadInfo.handle_mutex, NULL);
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_BRIEF_GLOBAL || \
MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
/* MPIU_THREAD_GRANULARITY_BRIEF_GLOBAL: There is a single, global
* lock, held only when needed */
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
/* MPIU_THREAD_GRANULARITY_PER_OBJECT: Multiple locks */
MPID_Thread_mutex_create(&MPIR_ThreadInfo.global_mutex, NULL);
MPID_Thread_mutex_create(&MPIR_ThreadInfo.handle_mutex, NULL);
MPID_Thread_mutex_create(&MPIR_ThreadInfo.msgq_mutex, NULL);
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
/* Updates to shared data and access to shared services is handled without
......@@ -182,14 +180,12 @@ int MPIR_Thread_CS_Finalize( void )
/* There is a single, global lock, held for the duration of an MPI call */
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.global_mutex, NULL);
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_BRIEF_GLOBAL || \
MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
/* MPIU_THREAD_GRANULARITY_BRIEF_GLOBAL: There is a single, global
* lock, held only when needed */
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
/* MPIU_THREAD_GRANULARITY_PER_OBJECT: There are multiple locks,
* one for each logical class (e.g., each type of object) */
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.global_mutex, NULL);
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.handle_mutex, NULL);
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.msgq_mutex, NULL);
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
/* Updates to shared data and access to shared services is handled without
......
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