Thread (34 messages) 34 messages, 7 authors, 2022-11-09

Re: [PATCH v11 8/9] PCI/P2PDMA: Allow userspace VMA allocations through sysfs

From: Chaitanya Kulkarni <hidden>
Date: 2022-10-25 01:44:28
Also in: linux-mm, linux-nvme, linux-pci, lkml

On 10/21/22 10:41, Logan Gunthorpe wrote:
Create a sysfs bin attribute called "allocate" under the existing
"p2pmem" group. The only allowable operation on this file is the mmap()
call.

When mmap() is called on this attribute, the kernel allocates a chunk of
memory from the genalloc and inserts the pages into the VMA. The
dev_pagemap .page_free callback will indicate when these pages are no
longer used and they will be put back into the genalloc.

On device unbind, remove the sysfs file before the memremap_pages are
cleaned up. This ensures unmap_mapping_range() is called on the files
inode and no new mappings can be created.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help