vhost-vdpa: fix page pinning leakage in error path (rework)
authorSi-Wei Liu <si-wei.liu@oracle.com>
Thu, 5 Nov 2020 23:26:33 +0000 (18:26 -0500)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 25 Nov 2020 09:29:07 +0000 (04:29 -0500)
commitad89653f79f1882d55d9df76c9b2b94f008c4e27
tree4c268935b5a197338f4b80d1f15fe7c2d50f1608
parent8009b0f4ab3151f3b8c1675ceb0f9151f09dddaa
vhost-vdpa: fix page pinning leakage in error path (rework)

Pinned pages are not properly accounted particularly when
mapping error occurs on IOTLB update. Clean up dangling
pinned pages for the error path.

The memory usage for bookkeeping pinned pages is reverted
to what it was before: only one single free page is needed.
This helps reduce the host memory demand for VM with a large
amount of memory, or in the situation where host is running
short of free memory.

Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
Link: https://lore.kernel.org/r/1604618793-4681-1-git-send-email-si-wei.liu@oracle.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/vhost/vdpa.c