aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys/mutex.h
diff options
context:
space:
mode:
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-04-25 22:10:47 +0000
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-04-25 22:10:47 +0000
commitbcd68186d8009957b751720a801e4c16bb272e83 (patch)
treeb5b0e1055f5bad5308e07c73bbf99892ec9188ed /include/sys/mutex.h
parent839d8b438e1d877fb4a625eed51f556433cbd6b6 (diff)
New an improved taskq implementation for the SPL. It allows a
configurable number of threads like the Solaris version and almost all of the options are supported. Unfortunately, it appears to have made absolutely no difference to our performance numbers. I need to keep looking for where we are bottle necking. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@93 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'include/sys/mutex.h')
-rw-r--r--include/sys/mutex.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/sys/mutex.h b/include/sys/mutex.h
index d7036b566..045842d72 100644
--- a/include/sys/mutex.h
+++ b/include/sys/mutex.h
@@ -36,6 +36,7 @@ typedef struct {
static __inline__ void
mutex_init(kmutex_t *mp, char *name, int type, void *ibc)
{
+ ENTRY;
ASSERT(mp);
ASSERT(ibc == NULL); /* XXX - Spin mutexes not needed */
ASSERT(type == MUTEX_DEFAULT); /* XXX - Only default type supported */
@@ -51,12 +52,14 @@ mutex_init(kmutex_t *mp, char *name, int type, void *ibc)
if (mp->km_name)
strcpy(mp->km_name, name);
}
+ EXIT;
}
#undef mutex_destroy
static __inline__ void
mutex_destroy(kmutex_t *mp)
{
+ ENTRY;
ASSERT(mp);
ASSERT(mp->km_magic == KM_MAGIC);
spin_lock(&mp->km_lock);
@@ -66,11 +69,13 @@ mutex_destroy(kmutex_t *mp)
memset(mp, KM_POISON, sizeof(*mp));
spin_unlock(&mp->km_lock);
+ EXIT;
}
static __inline__ void
mutex_enter(kmutex_t *mp)
{
+ ENTRY;
ASSERT(mp);
ASSERT(mp->km_magic == KM_MAGIC);
spin_lock(&mp->km_lock);
@@ -91,6 +96,7 @@ mutex_enter(kmutex_t *mp)
ASSERT(mp->km_owner == NULL);
mp->km_owner = current;
spin_unlock(&mp->km_lock);
+ EXIT;
}
/* Return 1 if we acquired the mutex, else zero. */
@@ -98,6 +104,7 @@ static __inline__ int
mutex_tryenter(kmutex_t *mp)
{
int rc;
+ ENTRY;
ASSERT(mp);
ASSERT(mp->km_magic == KM_MAGIC);
@@ -118,14 +125,16 @@ mutex_tryenter(kmutex_t *mp)
ASSERT(mp->km_owner == NULL);
mp->km_owner = current;
spin_unlock(&mp->km_lock);
- return 1;
+ RETURN(1);
}
- return 0;
+
+ RETURN(0);
}
static __inline__ void
mutex_exit(kmutex_t *mp)
{
+ ENTRY;
ASSERT(mp);
ASSERT(mp->km_magic == KM_MAGIC);
spin_lock(&mp->km_lock);
@@ -134,6 +143,7 @@ mutex_exit(kmutex_t *mp)
mp->km_owner = NULL;
spin_unlock(&mp->km_lock);
up(&mp->km_sem);
+ EXIT;
}
/* Return 1 if mutex is held by current process, else zero. */
@@ -141,6 +151,7 @@ static __inline__ int
mutex_owned(kmutex_t *mp)
{
int rc;
+ ENTRY;
ASSERT(mp);
ASSERT(mp->km_magic == KM_MAGIC);
@@ -148,7 +159,7 @@ mutex_owned(kmutex_t *mp)
rc = (mp->km_owner == current);
spin_unlock(&mp->km_lock);
- return rc;
+ RETURN(rc);
}
/* Return owner if mutex is owned, else NULL. */
@@ -156,6 +167,7 @@ static __inline__ kthread_t *
mutex_owner(kmutex_t *mp)
{
kthread_t *thr;
+ ENTRY;
ASSERT(mp);
ASSERT(mp->km_magic == KM_MAGIC);
@@ -163,7 +175,7 @@ mutex_owner(kmutex_t *mp)
thr = mp->km_owner;
spin_unlock(&mp->km_lock);
- return thr;
+ RETURN(thr);
}
#ifdef __cplusplus