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.
This commit is contained in:
parent
aa60062e00
commit
e431d66c04
@ -229,6 +229,7 @@ g_disk_setstate(struct bio *bp, struct g_disk_softc *sc)
|
||||
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) {
|
||||
|
@ -511,6 +511,7 @@ g_io_request(struct bio *bp, struct g_consumer *cp)
|
||||
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++;
|
||||
|
@ -373,6 +373,14 @@ devstat_end_transaction(struct devstat *ds, uint32_t bytes,
|
||||
|
||||
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;
|
||||
|
||||
@ -390,7 +398,7 @@ devstat_end_transaction_bio(struct devstat *ds, struct bio *bp)
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -199,6 +199,8 @@ void devstat_end_transaction(struct devstat *ds, u_int32_t bytes,
|
||||
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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user