diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2023-01-08 16:44:24 +0100 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2023-01-23 19:26:29 +0100 |
commit | 0886196ca8810c5b1f5097b71c4bc0df40b10208 (patch) | |
tree | ce3b10ea0f808d9a692bcc057b18fd84031fdd97 /drivers/vfio/virqfd.c | |
parent | vfio/mlx5: Allow loading of larger images than 512 MB (diff) | |
download | linux-0886196ca8810c5b1f5097b71c4bc0df40b10208.tar.xz linux-0886196ca8810c5b1f5097b71c4bc0df40b10208.zip |
vfio: Use GFP_KERNEL_ACCOUNT for userspace persistent allocations
Use GFP_KERNEL_ACCOUNT for userspace persistent allocations.
The GFP_KERNEL_ACCOUNT option lets the memory allocator know that this
is untrusted allocation triggered from userspace and should be a subject
of kmem accounting, and as such it is controlled by the cgroup
mechanism.
The way to find the relevant allocations was for example to look at the
close_device function and trace back all the kfrees to their
allocations.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20230108154427.32609-4-yishaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/virqfd.c')
-rw-r--r-- | drivers/vfio/virqfd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vfio/virqfd.c b/drivers/vfio/virqfd.c index 497a17b37865..29c564b7a6e1 100644 --- a/drivers/vfio/virqfd.c +++ b/drivers/vfio/virqfd.c @@ -112,7 +112,7 @@ int vfio_virqfd_enable(void *opaque, int ret = 0; __poll_t events; - virqfd = kzalloc(sizeof(*virqfd), GFP_KERNEL); + virqfd = kzalloc(sizeof(*virqfd), GFP_KERNEL_ACCOUNT); if (!virqfd) return -ENOMEM; |