vhost-vdpa: account iommu allocations
authorPasha Tatashin <pasha.tatashin@soleen.com>
Tue, 26 Dec 2023 18:28:27 +0000 (18:28 +0000)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 27 Dec 2023 20:50:36 +0000 (15:50 -0500)
iommu allocations should be accounted in order to allow admins to
monitor and limit the amount of iommu memory.

Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20231226182827.294158-1-pasha.tatashin@soleen.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
drivers/vhost/vdpa.c

index da7ec77cdaff075b5e66a21be7693cd6b7d30047..a51c69c078d93757ed9f6638a13e701f5ad820a7 100644 (file)
@@ -968,7 +968,8 @@ static int vhost_vdpa_map(struct vhost_vdpa *v, struct vhost_iotlb *iotlb,
                        r = ops->set_map(vdpa, asid, iotlb);
        } else {
                r = iommu_map(v->domain, iova, pa, size,
-                             perm_to_iommu_flags(perm), GFP_KERNEL);
+                             perm_to_iommu_flags(perm),
+                             GFP_KERNEL_ACCOUNT);
        }
        if (r) {
                vhost_iotlb_del_range(iotlb, iova, iova + size - 1);