Re: [PATCH 1/6] kernfs: create vm_operations_struct without page_mkwrite()

Bjorn Helgaas
2024-06-05T21:43:45Z

On Wed, Jun 05, 2024 at 01:29:29PM -0600, Martin Oliveira wrote:
> The standard kernfs vm_ops installs a page_mkwrite() operator which
> modifies the file update time on write.
>
> This not always required (or makes sense), such as in the P2PDMA, which

s/This/This is/ ?

> uses the sysfs file as an allocator from userspace.
>
> Furthermore, having the page_mkwrite() operator causes
> writable_file_mapping_allowed() to fail due to
> vma_needs_dirty_tracking() on the gup flow, which is a pre-requisite for
> enabling P2PDMA over RDMA.
>
> Fix this by adding a new boolean on kernfs_ops to differentiate between
> the different behaviours.

> + * Use the file as an allocator from userspace. This disables
> + * page_mkwrite() to prevent the file time from being updated on write
> + * which enables using GUP with FOLL_LONGTERM with memory that's been
> + * mmaped.

"mmaped" does seem more commonly used in Linux than "mmapped", but the
base word "mapped" definitely requires "pp", so "mmaped" looks funny
to me.