mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 02:20:59 +03:00
Move gethrtime() calls out of vdev queue lock
This dramatically reduces the lock contention on systems with slower (non-TSC) timecounters. With TSC the difference is minimal, but since this lock is pretty congested, any improvement counts. Plus I don't see any reason to do it under the lock other than the latency of the lock itself, which this change actually reduces. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Closes #12281
This commit is contained in:
parent
dab147d65a
commit
41b33dce44
@ -912,9 +912,9 @@ vdev_queue_io(zio_t *zio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
zio->io_flags |= ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE;
|
zio->io_flags |= ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE;
|
||||||
|
zio->io_timestamp = gethrtime();
|
||||||
|
|
||||||
mutex_enter(&vq->vq_lock);
|
mutex_enter(&vq->vq_lock);
|
||||||
zio->io_timestamp = gethrtime();
|
|
||||||
vdev_queue_io_add(vq, zio);
|
vdev_queue_io_add(vq, zio);
|
||||||
nio = vdev_queue_io_to_issue(vq);
|
nio = vdev_queue_io_to_issue(vq);
|
||||||
mutex_exit(&vq->vq_lock);
|
mutex_exit(&vq->vq_lock);
|
||||||
@ -936,14 +936,13 @@ vdev_queue_io_done(zio_t *zio)
|
|||||||
vdev_queue_t *vq = &zio->io_vd->vdev_queue;
|
vdev_queue_t *vq = &zio->io_vd->vdev_queue;
|
||||||
zio_t *nio;
|
zio_t *nio;
|
||||||
|
|
||||||
|
hrtime_t now = gethrtime();
|
||||||
|
vq->vq_io_complete_ts = now;
|
||||||
|
vq->vq_io_delta_ts = zio->io_delta = now - zio->io_timestamp;
|
||||||
|
|
||||||
mutex_enter(&vq->vq_lock);
|
mutex_enter(&vq->vq_lock);
|
||||||
|
|
||||||
vdev_queue_pending_remove(vq, zio);
|
vdev_queue_pending_remove(vq, zio);
|
||||||
|
|
||||||
zio->io_delta = gethrtime() - zio->io_timestamp;
|
|
||||||
vq->vq_io_complete_ts = gethrtime();
|
|
||||||
vq->vq_io_delta_ts = vq->vq_io_complete_ts - zio->io_timestamp;
|
|
||||||
|
|
||||||
while ((nio = vdev_queue_io_to_issue(vq)) != NULL) {
|
while ((nio = vdev_queue_io_to_issue(vq)) != NULL) {
|
||||||
mutex_exit(&vq->vq_lock);
|
mutex_exit(&vq->vq_lock);
|
||||||
if (nio->io_done == vdev_queue_agg_io_done) {
|
if (nio->io_done == vdev_queue_agg_io_done) {
|
||||||
|
Loading…
Reference in New Issue
Block a user