aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio/vfio_iommu_type1.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2019-08-11 23:24:46 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-08-11 23:24:46 -0700
commit4aa31b4b61e4985e719352c329c3948d1932cb64 (patch)
tree251d6d11d1e5c9c09adc3e0eb1715c56b2e16c95 /drivers/vfio/vfio_iommu_type1.c
parentInput: remove w90x900 touchscreen driver (diff)
parentLinux 5.3-rc4 (diff)
downloadlinux-dev-4aa31b4b61e4985e719352c329c3948d1932cb64.tar.xz
linux-dev-4aa31b4b61e4985e719352c329c3948d1932cb64.zip
Merge tag 'v5.3-rc4' into next
Sync up with mainline to bring in device_property_count_u32 andother newer APIs.
Diffstat (limited to 'drivers/vfio/vfio_iommu_type1.c')
-rw-r--r--drivers/vfio/vfio_iommu_type1.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index add34adfadc7..054391f30fa8 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -272,21 +272,8 @@ static int vfio_lock_acct(struct vfio_dma *dma, long npage, bool async)
ret = down_write_killable(&mm->mmap_sem);
if (!ret) {
- if (npage > 0) {
- if (!dma->lock_cap) {
- unsigned long limit;
-
- limit = task_rlimit(dma->task,
- RLIMIT_MEMLOCK) >> PAGE_SHIFT;
-
- if (mm->locked_vm + npage > limit)
- ret = -ENOMEM;
- }
- }
-
- if (!ret)
- mm->locked_vm += npage;
-
+ ret = __account_locked_vm(mm, abs(npage), npage > 0, dma->task,
+ dma->lock_cap);
up_write(&mm->mmap_sem);
}