summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-06-26 23:27:42 +0000
committerrwatson <rwatson@FreeBSD.org>2004-06-26 23:27:42 +0000
commitddb1bad6a35a7a69ac921f84ecd8dd66c69b4415 (patch)
treed6583006cb6461a59585bf7cbe82c1a5ee7d8039 /sys
parent4c4f36d309ed95981307d49deb86788d8024cd7d (diff)
downloadFreeBSD-src-ddb1bad6a35a7a69ac921f84ecd8dd66c69b4415.zip
FreeBSD-src-ddb1bad6a35a7a69ac921f84ecd8dd66c69b4415.tar.gz
The g_up and g_down threads use a local 'mymutex' mutex to allow WITNESS
to warn about attempts to sleep in the I/O path. This change pushes the definition and use of 'mymutex' behind #ifdef WITNESS to avoid the cost in non-debugging cases. This results in a clear .22% performance win for 512 byte and 1k I/O tests on my SMP test box. Not much, but every bit counts.
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/geom_io.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index 7b5b115..19d5de7 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -315,10 +315,12 @@ g_io_schedule_down(struct thread *tp __unused)
struct bio *bp;
off_t excess;
int error;
+#ifdef WITNESS
struct mtx mymutex;
bzero(&mymutex, sizeof mymutex);
mtx_init(&mymutex, "g_xdown", NULL, MTX_DEF);
+#endif
for(;;) {
g_bioq_lock(&g_bio_run_down);
@@ -357,9 +359,13 @@ g_io_schedule_down(struct thread *tp __unused)
default:
break;
}
+#ifdef WITNESS
mtx_lock(&mymutex);
+#endif
bp->bio_to->geom->start(bp);
+#ifdef WITNESS
mtx_unlock(&mymutex);
+#endif
}
}
@@ -384,26 +390,36 @@ void
g_io_schedule_up(struct thread *tp __unused)
{
struct bio *bp;
+#ifdef WITNESS
struct mtx mymutex;
bzero(&mymutex, sizeof mymutex);
mtx_init(&mymutex, "g_xup", NULL, MTX_DEF);
+#endif
for(;;) {
g_bioq_lock(&g_bio_run_up);
bp = g_bioq_first(&g_bio_run_task);
if (bp != NULL) {
g_bioq_unlock(&g_bio_run_up);
+#ifdef WITNESS
mtx_lock(&mymutex);
+#endif
bp->bio_task(bp->bio_task_arg);
+#ifdef WITNESS
mtx_unlock(&mymutex);
+#endif
continue;
}
bp = g_bioq_first(&g_bio_run_up);
if (bp != NULL) {
g_bioq_unlock(&g_bio_run_up);
+#ifdef WITNESS
mtx_lock(&mymutex);
+#endif
biodone(bp);
+#ifdef WITNESS
mtx_unlock(&mymutex);
+#endif
continue;
}
msleep(&g_wait_up, &g_bio_run_up.bio_queue_lock,
OpenPOWER on IntegriCloud