On 08/01/2023 15:44, Yishai Hadas wrote: > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > 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 accountingis, 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@xxxxxxxxxx> > Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxx> > --- > drivers/vfio/container.c | 2 +- > drivers/vfio/pci/vfio_pci_config.c | 6 +++--- > drivers/vfio/pci/vfio_pci_core.c | 7 ++++--- > drivers/vfio/pci/vfio_pci_igd.c | 2 +- > drivers/vfio/pci/vfio_pci_intrs.c | 10 ++++++---- > drivers/vfio/pci/vfio_pci_rdwr.c | 2 +- > drivers/vfio/virqfd.c | 2 +- > 7 files changed, 17 insertions(+), 14 deletions(-) > I am not sure, but should we add the call in the kzalloc done in iova_bitmap_init() too ? It is called from DMA_LOGGING_REPORT | FEATURE_GET. It is not persistent though, but userspace triggerable. Joao