aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys/condvar.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/condvar.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/condvar.h')
-rw-r--r--include/sys/condvar.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/sys/condvar.h b/include/sys/condvar.h
index fd845d9c1..2878b68a8 100644
--- a/include/sys/condvar.h
+++ b/include/sys/condvar.h
@@ -28,6 +28,7 @@ typedef enum { CV_DEFAULT=0, CV_DRIVER } kcv_type_t;
static __inline__ void
cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg)
{
+ ENTRY;
ASSERT(cvp);
ASSERT(type == CV_DEFAULT);
ASSERT(arg == NULL);
@@ -44,11 +45,14 @@ cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg)
if (cvp->cv_name)
strcpy(cvp->cv_name, name);
}
+
+ EXIT;
}
static __inline__ void
cv_destroy(kcondvar_t *cvp)
{
+ ENTRY;
ASSERT(cvp);
ASSERT(cvp->cv_magic == CV_MAGIC);
spin_lock(&cvp->cv_lock);
@@ -60,12 +64,14 @@ cv_destroy(kcondvar_t *cvp)
memset(cvp, CV_POISON, sizeof(*cvp));
spin_unlock(&cvp->cv_lock);
+ EXIT;
}
static __inline__ void
cv_wait(kcondvar_t *cvp, kmutex_t *mtx)
{
DEFINE_WAIT(wait);
+ ENTRY;
ASSERT(cvp);
ASSERT(mtx);
@@ -93,6 +99,7 @@ cv_wait(kcondvar_t *cvp, kmutex_t *mtx)
atomic_dec(&cvp->cv_waiters);
finish_wait(&cvp->cv_event, &wait);
+ EXIT;
}
/* 'expire_time' argument is an absolute wall clock time in jiffies.
@@ -103,6 +110,7 @@ cv_timedwait(kcondvar_t *cvp, kmutex_t *mtx, clock_t expire_time)
{
DEFINE_WAIT(wait);
clock_t time_left;
+ ENTRY;
ASSERT(cvp);
ASSERT(mtx);
@@ -120,7 +128,7 @@ cv_timedwait(kcondvar_t *cvp, kmutex_t *mtx, clock_t expire_time)
/* XXX - Does not handle jiffie wrap properly */
time_left = expire_time - jiffies;
if (time_left <= 0)
- return -1;
+ RETURN(-1);
prepare_to_wait_exclusive(&cvp->cv_event, &wait,
TASK_UNINTERRUPTIBLE);
@@ -136,12 +144,13 @@ cv_timedwait(kcondvar_t *cvp, kmutex_t *mtx, clock_t expire_time)
atomic_dec(&cvp->cv_waiters);
finish_wait(&cvp->cv_event, &wait);
- return (time_left > 0 ? time_left : -1);
+ RETURN(time_left > 0 ? time_left : -1);
}
static __inline__ void
cv_signal(kcondvar_t *cvp)
{
+ ENTRY;
ASSERT(cvp);
ASSERT(cvp->cv_magic == CV_MAGIC);
@@ -151,6 +160,8 @@ cv_signal(kcondvar_t *cvp)
* the wait queue to ensure we don't race waking up processes. */
if (atomic_read(&cvp->cv_waiters) > 0)
wake_up(&cvp->cv_event);
+
+ EXIT;
}
static __inline__ void
@@ -158,10 +169,13 @@ cv_broadcast(kcondvar_t *cvp)
{
ASSERT(cvp);
ASSERT(cvp->cv_magic == CV_MAGIC);
+ ENTRY;
/* Wake_up_all() will wake up all waiters even those which
* have the WQ_FLAG_EXCLUSIVE flag set. */
if (atomic_read(&cvp->cv_waiters) > 0)
wake_up_all(&cvp->cv_event);
+
+ EXIT;
}
#endif /* _SPL_CONDVAR_H */