From owner-svn-src-all@FreeBSD.ORG Thu May 8 12:26:09 2014 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 ESMTPS id 430527ED; Thu, 8 May 2014 12:26:09 +0000 (UTC) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FAC0988; Thu, 8 May 2014 12:26:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s48CQ91V090245; Thu, 8 May 2014 12:26:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s48CQ8vI090241; Thu, 8 May 2014 12:26:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201405081226.s48CQ8vI090241@svn.freebsd.org> From: Alexander Motin Date: Thu, 8 May 2014 12:26:08 +0000 (UTC) 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 X-SVN-Group: stable-9 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.18 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: Thu, 08 May 2014 12:26:09 -0000 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 */