Date: Thu, 8 May 2014 12:26:08 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r265671 - in stable/9/sys: geom kern sys Message-ID: <201405081226.s48CQ8vI090241@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu May 8 12:26:08 2014 New Revision: 265671 URL: http://svnweb.freebsd.org/changeset/base/265671 Log: MFC r256603: 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: stable/9/sys/geom/geom_disk.c stable/9/sys/geom/geom_io.c stable/9/sys/kern/subr_devstat.c stable/9/sys/sys/devicestat.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/geom/geom_disk.c ============================================================================== --- stable/9/sys/geom/geom_disk.c Thu May 8 12:23:30 2014 (r265670) +++ stable/9/sys/geom/geom_disk.c Thu May 8 12:26:08 2014 (r265671) @@ -233,6 +233,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; @@ -241,12 +242,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: stable/9/sys/geom/geom_io.c ============================================================================== --- stable/9/sys/geom/geom_io.c Thu May 8 12:23:30 2014 (r265670) +++ stable/9/sys/geom/geom_io.c Thu May 8 12:26:08 2014 (r265671) @@ -510,6 +510,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; @@ -563,11 +564,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: stable/9/sys/kern/subr_devstat.c ============================================================================== --- stable/9/sys/kern/subr_devstat.c Thu May 8 12:23:30 2014 (r265670) +++ stable/9/sys/kern/subr_devstat.c Thu May 8 12:26:08 2014 (r265671) @@ -339,6 +339,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 */ @@ -355,7 +363,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: stable/9/sys/sys/devicestat.h ============================================================================== --- stable/9/sys/sys/devicestat.h Thu May 8 12:23:30 2014 (r265670) +++ stable/9/sys/sys/devicestat.h Thu May 8 12:26:08 2014 (r265671) @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405081226.s48CQ8vI090241>