mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Avoid dynamic allocation of 'search zio'
As part of commit e8b96c6
the search zio used by the
vdev_queue_io_to_issue() function was moved to the heap
to minimize stack usage. Functionally this is fine, but
to maximize performance it's best to minimize the number
of dynamic allocations.
To avoid this allocation temporary space for the search
zio has been reserved in the vdev_queue structure. All
access must be serialized through the vq_lock.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #2572
This commit is contained in:
parent
ab6f407faa
commit
50b25b2187
@ -118,6 +118,7 @@ struct vdev_queue {
|
|||||||
hrtime_t vq_io_complete_ts; /* time last i/o completed */
|
hrtime_t vq_io_complete_ts; /* time last i/o completed */
|
||||||
hrtime_t vq_io_delta_ts;
|
hrtime_t vq_io_delta_ts;
|
||||||
list_t vq_io_list;
|
list_t vq_io_list;
|
||||||
|
zio_t vq_io_search; /* used as local for stack reduction */
|
||||||
kmutex_t vq_lock;
|
kmutex_t vq_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -659,7 +659,6 @@ vdev_queue_io_to_issue(vdev_queue_t *vq)
|
|||||||
zio_priority_t p;
|
zio_priority_t p;
|
||||||
avl_index_t idx;
|
avl_index_t idx;
|
||||||
vdev_queue_class_t *vqc;
|
vdev_queue_class_t *vqc;
|
||||||
zio_t *search;
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
ASSERT(MUTEX_HELD(&vq->vq_lock));
|
ASSERT(MUTEX_HELD(&vq->vq_lock));
|
||||||
@ -678,11 +677,10 @@ again:
|
|||||||
* For FIFO queues (sync), issue the i/o with the lowest timestamp.
|
* For FIFO queues (sync), issue the i/o with the lowest timestamp.
|
||||||
*/
|
*/
|
||||||
vqc = &vq->vq_class[p];
|
vqc = &vq->vq_class[p];
|
||||||
search = zio_buf_alloc(sizeof (*search));
|
vq->vq_io_search.io_timestamp = 0;
|
||||||
search->io_timestamp = 0;
|
vq->vq_io_search.io_offset = vq->vq_last_offset + 1;
|
||||||
search->io_offset = vq->vq_last_offset + 1;
|
VERIFY3P(avl_find(&vqc->vqc_queued_tree, &vq->vq_io_search,
|
||||||
VERIFY3P(avl_find(&vqc->vqc_queued_tree, search, &idx), ==, NULL);
|
&idx), ==, NULL);
|
||||||
zio_buf_free(search, sizeof (*search));
|
|
||||||
zio = avl_nearest(&vqc->vqc_queued_tree, idx, AVL_AFTER);
|
zio = avl_nearest(&vqc->vqc_queued_tree, idx, AVL_AFTER);
|
||||||
if (zio == NULL)
|
if (zio == NULL)
|
||||||
zio = avl_first(&vqc->vqc_queued_tree);
|
zio = avl_first(&vqc->vqc_queued_tree);
|
||||||
|
Loading…
Reference in New Issue
Block a user