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

From: Greg Kroah-Hartman
Date: Thu Jun 06 2024 - 16:54:21 EST


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
> uses the sysfs file as an allocator from userspace.

That's not a good idea, please don't do that. sysfs binary files are
"pass through", why would you want to use this as an allocator?

> 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.

This isn't going to work well.

What exactly are you wanting to do in sysfs that you feel this is
required?

thanks,

greg k-h