]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit - drivers/vfio/vfio_iommu_type1.c
vfio/type1: Reduce repetitive calls in vfio_pin_pages_remote()
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 17 Apr 2017 22:07:06 +0000 (16:07 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 18 Apr 2017 21:01:15 +0000 (15:01 -0600)
commit7cb671e7a34d73b29df77d0b53492277744e57e7
treec8ec48571db212aabe91b5fc77a20fb8277d78a0
parent80dbe1fbafbf469fd19862f0d400b769bff0ee46
vfio/type1: Reduce repetitive calls in vfio_pin_pages_remote()

vfio_pin_pages_remote() is typically called to iterate over a range
of memory.  Testing CAP_IPC_LOCK is relatively expensive, so it makes
sense to push it up to the caller, which can then repeatedly call
vfio_pin_pages_remote() using that value.  This can show nearly a 20%
improvement on the worst case path through VFIO_IOMMU_MAP_DMA with
contiguous page mapping disabled.  Testing RLIMIT_MEMLOCK is much more
lightweight, but we bring it along on the same principle and it does
seem to show a marginal improvement.

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c