On Tue, Apr 07, 2015 at 05:06:11PM +0300, Boaz Harrosh wrote:
[v5]
Changed comments about pte_same check after the call to
pfn_mkwrite and the return value.
[v4]
Kirill's comments about splitting out a new wp_pfn_shared().
Add Documentation/filesystems/Locking text about pfn_mkwrite.
[v3]
Kirill's comments about use of linear_page_index()
[v2]
Based on linux-next/akpm [3dc4623]. For v4.1 merge window
Incorporated comments from Andrew And Kirill
[v1]
This will allow FS that uses VM_PFNMAP | VM_MIXEDMAP (no page structs)
to get notified when access is a write to a read-only PFN.
This can happen if we mmap() a file then first mmap-read from it
to page-in a read-only PFN, than we mmap-write to the same page.
We need this functionality to fix a DAX bug, where in the scenario
above we fail to set ctime/mtime though we modified the file.
An xfstest is attached to this patchset that shows the failure
and the fix. (A DAX patch will follow)
This functionality is extra important for us, because upon
dirtying of a pmem page we also want to RDMA the page to a
remote cluster node.
We define a new pfn_mkwrite and do not reuse page_mkwrite because
1 - The name ;-)
2 - But mainly because it would take a very long and tedious
audit of all page_mkwrite functions of VM_MIXEDMAP/VM_PFNMAP
users. To make sure they do not now CRASH. For example current
DAX code (which this is for) would crash.
If we would want to reuse page_mkwrite, We will need to first
patch all users, so to not-crash-on-no-page. Then enable this
patch. But even if I did that I would not sleep so well at night.
Adding a new vector is the safest thing to do, and is not that
expensive. an extra pointer at a static function vector per driver.
Also the new vector is better for performance, because else we
Will call all current Kernel vectors, so to:
check-ha-no-page-do-nothing and return.
No need to call it from do_shared_fault because do_wp_page is called to
change pte permissions anyway.
CC: Kirill A. Shutemov <kirill.shutemov(a)linux.intel.com>
CC: Matthew Wilcox <matthew.r.wilcox(a)intel.com>
CC: Jan Kara <jack(a)suse.cz>
CC: Andrew Morton <akpm(a)linux-foundation.org>
CC: Hugh Dickins <hughd(a)google.com>
CC: Mel Gorman <mgorman(a)suse.de>
CC: linux-mm(a)kvack.org
Signed-off-by: Yigal Korman <yigal(a)plexistor.com>
Signed-off-by: Boaz Harrosh <boaz(a)plexistor.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov(a)linux.intel.com>
--
Kirill A. Shutemov