From owner-svn-src-all@FreeBSD.ORG Wed Oct 16 09:12:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 38A78C40; Wed, 16 Oct 2013 09:12:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 249BB2D4D; Wed, 16 Oct 2013 09:12:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9G9Cfs7098431; Wed, 16 Oct 2013 09:12:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9G9CfZd098426; Wed, 16 Oct 2013 09:12:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310160912.r9G9CfZd098426@svn.freebsd.org> From: Alexander Motin Date: Wed, 16 Oct 2013 09:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256603 - in head/sys: geom kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2013 09:12:42 -0000 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 */