svn commit: r256603 - in head/sys: geom kern sys
Alexander Motin
mav at FreeBSD.org
Wed Oct 16 09:12:42 UTC 2013
Author: mav
Date: Wed Oct 16 09:12:40 2013
New Revision: 256603
URL: http://svnweb.freebsd.org/changeset/base/256603
Log:
MFprojects/camlock r254905:
Introduce new function devstat_end_transaction_bio_bt(), adding new argument
to specify present time. Use this function to move binuptime() out of lock,
substantially reducing lock congestion when slow timecounter is used.
Modified:
head/sys/geom/geom_disk.c
head/sys/geom/geom_io.c
head/sys/kern/subr_devstat.c
head/sys/sys/devicestat.h
Modified: head/sys/geom/geom_disk.c
==============================================================================
--- head/sys/geom/geom_disk.c Wed Oct 16 09:05:49 2013 (r256602)
+++ head/sys/geom/geom_disk.c Wed Oct 16 09:12:40 2013 (r256603)
@@ -229,6 +229,7 @@ g_disk_setstate(struct bio *bp, struct g
static void
g_disk_done(struct bio *bp)
{
+ struct bintime now;
struct bio *bp2;
struct g_disk_softc *sc;
@@ -237,12 +238,13 @@ g_disk_done(struct bio *bp)
bp2 = bp->bio_parent;
sc = bp2->bio_to->private;
bp->bio_completed = bp->bio_length - bp->bio_resid;
+ binuptime(&now);
mtx_lock(&sc->done_mtx);
if (bp2->bio_error == 0)
bp2->bio_error = bp->bio_error;
bp2->bio_completed += bp->bio_completed;
if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0)
- devstat_end_transaction_bio(sc->dp->d_devstat, bp);
+ devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now);
g_destroy_bio(bp);
bp2->bio_inbed++;
if (bp2->bio_children == bp2->bio_inbed) {
Modified: head/sys/geom/geom_io.c
==============================================================================
--- head/sys/geom/geom_io.c Wed Oct 16 09:05:49 2013 (r256602)
+++ head/sys/geom/geom_io.c Wed Oct 16 09:12:40 2013 (r256603)
@@ -511,6 +511,7 @@ g_io_request(struct bio *bp, struct g_co
void
g_io_deliver(struct bio *bp, int error)
{
+ struct bintime now;
struct g_consumer *cp;
struct g_provider *pp;
int first;
@@ -564,11 +565,13 @@ g_io_deliver(struct bio *bp, int error)
* can not update one instance of the statistics from more
* than one thread at a time, so grab the lock first.
*/
+ if (g_collectstats)
+ binuptime(&now);
g_bioq_lock(&g_bio_run_up);
if (g_collectstats & 1)
- devstat_end_transaction_bio(pp->stat, bp);
+ devstat_end_transaction_bio_bt(pp->stat, bp, &now);
if (g_collectstats & 2)
- devstat_end_transaction_bio(cp->stat, bp);
+ devstat_end_transaction_bio_bt(cp->stat, bp, &now);
cp->nend++;
pp->nend++;
Modified: head/sys/kern/subr_devstat.c
==============================================================================
--- head/sys/kern/subr_devstat.c Wed Oct 16 09:05:49 2013 (r256602)
+++ head/sys/kern/subr_devstat.c Wed Oct 16 09:12:40 2013 (r256603)
@@ -374,6 +374,14 @@ devstat_end_transaction(struct devstat *
void
devstat_end_transaction_bio(struct devstat *ds, struct bio *bp)
{
+
+ devstat_end_transaction_bio_bt(ds, bp, NULL);
+}
+
+void
+devstat_end_transaction_bio_bt(struct devstat *ds, struct bio *bp,
+ struct bintime *now)
+{
devstat_trans_flags flg;
/* sanity check */
@@ -390,7 +398,7 @@ devstat_end_transaction_bio(struct devst
flg = DEVSTAT_NO_DATA;
devstat_end_transaction(ds, bp->bio_bcount - bp->bio_resid,
- DEVSTAT_TAG_SIMPLE, flg, NULL, &bp->bio_t0);
+ DEVSTAT_TAG_SIMPLE, flg, now, &bp->bio_t0);
DTRACE_DEVSTAT_BIO_DONE();
}
Modified: head/sys/sys/devicestat.h
==============================================================================
--- head/sys/sys/devicestat.h Wed Oct 16 09:05:49 2013 (r256602)
+++ head/sys/sys/devicestat.h Wed Oct 16 09:12:40 2013 (r256603)
@@ -199,6 +199,8 @@ void devstat_end_transaction(struct devs
devstat_trans_flags flags,
struct bintime *now, struct bintime *then);
void devstat_end_transaction_bio(struct devstat *ds, struct bio *bp);
+void devstat_end_transaction_bio_bt(struct devstat *ds, struct bio *bp,
+ struct bintime *now);
#endif
#endif /* _DEVICESTAT_H */
More information about the svn-src-all
mailing list