aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-04-06 11:29:23 -0700
committerBrian Behlendorf <[email protected]>2012-04-06 12:06:19 -0700
commitb29012b99994ece46019b664d67dace29e5c2586 (patch)
tree8a06ed6dd8441212d654ec6b940bef953c4cc879
parent8920c6918a984a9624c853460fe00e9a200bbd48 (diff)
Remove condition variable names
Long ago I added support to the spl for condition variable names because I thought they might be needed. It turns out they aren't. In fact the official Solaris cv_init(9F) man page discourages their use in the kernel. cv_init(9F) Parameters name - Descriptive string. This is obsolete and should be NULL. (Non-NULL strings are legal, but they're a waste of kernel memory.) Therefore, I'm removing them from the spl to reclaim this memory and adding an ASSERT() to ensure no new consumers are added which make use of the name. Signed-off-by: Brian Behlendorf <[email protected]>
-rw-r--r--include/sys/condvar.h10
-rw-r--r--module/spl/spl-condvar.c11
-rw-r--r--module/splat/splat-condvar.c10
3 files changed, 7 insertions, 24 deletions
diff --git a/include/sys/condvar.h b/include/sys/condvar.h
index ca9dd0f52..59407c2dd 100644
--- a/include/sys/condvar.h
+++ b/include/sys/condvar.h
@@ -39,8 +39,6 @@
typedef struct {
int cv_magic;
- char *cv_name;
- int cv_name_size;
wait_queue_head_t cv_event;
wait_queue_head_t cv_destroy;
atomic_t cv_waiters;
@@ -59,13 +57,7 @@ extern clock_t __cv_timedwait_interruptible(kcondvar_t *cvp, kmutex_t *mp,
extern void __cv_signal(kcondvar_t *cvp);
extern void __cv_broadcast(kcondvar_t *cvp);
-#define cv_init(cvp, name, type, arg) \
-({ \
- if ((name) == NULL) \
- __cv_init(cvp, #cvp, type, arg); \
- else \
- __cv_init(cvp, name, type, arg); \
-})
+#define cv_init(cvp, name, type, arg) __cv_init(cvp, name, type, arg)
#define cv_destroy(cvp) __cv_destroy(cvp)
#define cv_wait(cvp, mp) __cv_wait(cvp, mp)
#define cv_wait_interruptible(cvp, mp) __cv_wait_interruptible(cvp,mp)
diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c
index 2730435c7..52131c1e8 100644
--- a/module/spl/spl-condvar.c
+++ b/module/spl/spl-condvar.c
@@ -40,7 +40,7 @@ __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg)
SENTRY;
ASSERT(cvp);
- ASSERT(name);
+ ASSERT(name == NULL);
ASSERT(type == CV_DEFAULT);
ASSERT(arg == NULL);
@@ -49,8 +49,6 @@ __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg)
init_waitqueue_head(&cvp->cv_destroy);
atomic_set(&cvp->cv_waiters, 0);
cvp->cv_mutex = NULL;
- cvp->cv_name = NULL;
- cvp->cv_name_size = strlen(name) + 1;
/* We may be called when there is a non-zero preempt_count or
* interrupts are disabled is which case we must not sleep.
@@ -58,10 +56,6 @@ __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg)
if (current_thread_info()->preempt_count || irqs_disabled())
flags = KM_NOSLEEP;
- cvp->cv_name = kmem_alloc(cvp->cv_name_size, flags);
- if (cvp->cv_name)
- strcpy(cvp->cv_name, name);
-
SEXIT;
}
EXPORT_SYMBOL(__cv_init);
@@ -91,9 +85,6 @@ __cv_destroy(kcondvar_t *cvp)
ASSERT(atomic_read(&cvp->cv_waiters) == 0);
ASSERT(!waitqueue_active(&cvp->cv_event));
- if (cvp->cv_name)
- kmem_free(cvp->cv_name, cvp->cv_name_size);
-
SEXIT;
}
EXPORT_SYMBOL(__cv_destroy);
diff --git a/module/splat/splat-condvar.c b/module/splat/splat-condvar.c
index ace9823c3..14000adbd 100644
--- a/module/splat/splat-condvar.c
+++ b/module/splat/splat-condvar.c
@@ -102,7 +102,7 @@ splat_condvar_test1(struct file *file, void *arg)
cv.cv_magic = SPLAT_CONDVAR_TEST_MAGIC;
cv.cv_file = file;
mutex_init(&cv.cv_mtx, SPLAT_CONDVAR_TEST_NAME, MUTEX_DEFAULT, NULL);
- cv_init(&cv.cv_condvar, SPLAT_CONDVAR_TEST_NAME, CV_DEFAULT, NULL);
+ cv_init(&cv.cv_condvar, NULL, CV_DEFAULT, NULL);
/* Create some threads, the exact number isn't important just as
* long as we know how many we managed to create and should expect. */
@@ -166,7 +166,7 @@ splat_condvar_test2(struct file *file, void *arg)
cv.cv_magic = SPLAT_CONDVAR_TEST_MAGIC;
cv.cv_file = file;
mutex_init(&cv.cv_mtx, SPLAT_CONDVAR_TEST_NAME, MUTEX_DEFAULT, NULL);
- cv_init(&cv.cv_condvar, SPLAT_CONDVAR_TEST_NAME, CV_DEFAULT, NULL);
+ cv_init(&cv.cv_condvar, NULL, CV_DEFAULT, NULL);
/* Create some threads, the exact number isn't important just as
* long as we know how many we managed to create and should expect. */
@@ -248,7 +248,7 @@ splat_condvar_test3(struct file *file, void *arg)
cv.cv_magic = SPLAT_CONDVAR_TEST_MAGIC;
cv.cv_file = file;
mutex_init(&cv.cv_mtx, SPLAT_CONDVAR_TEST_NAME, MUTEX_DEFAULT, NULL);
- cv_init(&cv.cv_condvar, SPLAT_CONDVAR_TEST_NAME, CV_DEFAULT, NULL);
+ cv_init(&cv.cv_condvar, NULL, CV_DEFAULT, NULL);
/* Create some threads, the exact number isn't important just as
* long as we know how many we managed to create and should expect. */
@@ -317,7 +317,7 @@ splat_condvar_test4(struct file *file, void *arg)
cv.cv_magic = SPLAT_CONDVAR_TEST_MAGIC;
cv.cv_file = file;
mutex_init(&cv.cv_mtx, SPLAT_CONDVAR_TEST_NAME, MUTEX_DEFAULT, NULL);
- cv_init(&cv.cv_condvar, SPLAT_CONDVAR_TEST_NAME, CV_DEFAULT, NULL);
+ cv_init(&cv.cv_condvar, NULL, CV_DEFAULT, NULL);
/* Create some threads, the exact number isn't important just as
* long as we know how many we managed to create and should expect. */
@@ -386,7 +386,7 @@ splat_condvar_test5(struct file *file, void *arg)
int rc = 0;
mutex_init(&mtx, SPLAT_CONDVAR_TEST_NAME, MUTEX_DEFAULT, NULL);
- cv_init(&condvar, SPLAT_CONDVAR_TEST_NAME, CV_DEFAULT, NULL);
+ cv_init(&condvar, NULL, CV_DEFAULT, NULL);
splat_vprint(file, SPLAT_CONDVAR_TEST5_NAME, "Thread going to sleep for "
"%d second and expecting to be woken by timeout\n", 1);