On Wednesday 01 March 2017 03:19 PM, Jan Kara wrote:
Hi,
On Fri 24-02-17 19:23:52, Aneesh Kumar K.V wrote:
I am hitting this while running stress test with the saved write patch
series. I guess we are missing a set page dirty some where. I will
continue to debug this, but if you have any suggestion let me know.
<snip>
So this warning can happen when page got dirtied but ->page_mkwrite() was
not called. I don't know details of how autonuma works but a quick look
suggests that autonuma can also do numa hinting faults for file pages.
So the following seems to be possible:
Autonuma decides to check for accesses to a mapped shared file page that is
dirty. pte_present gets cleared, pte_write stays set (due to logic
introduced in commit b191f9b106 "mm: numa: preserve PTE write permissions
across a NUMA hinting fault"). Then page writeback happens, page_mkclean()
is called to write-protect the page. However page_check_address() returns
NULL for the PTE (__page_check_address() returns NULL for !pte_present
PTEs) so we don't clear pte_write bit in page_mkclean_one().
Even though we cleared _PAGE_PRESENT a pte_present() check return true
for numa fault pte. The problem with savedwrite patch series that i
quoted in the original mail was that pte_write() was checking on
_PAGE_WRITE where as numa fault stashed the write bit as savedwrite bit.
Hence page_mkclean was skipping those ptes.
Sometime later
a process looks at the page through mmap, takes NUMA fault and
do_numa_page() reestablishes a writeable mapping of the page although the
filesystem does not expect there to be one and funny things happen
afterwards...
I'll defer to more mm-savvy people to decide how this should be fixed. My
naive understanding is that page_mkclean_one() should clear the pte_write
bit even for pages that are undergoing NUMA probation but I'm not sure
about a preferred way to achieve that...
Yes found that and finally decided that instead of fixing all those code
path, we can update pte_write to handle autonuma preserved write bit.
https://lkml.kernel.org/r/1488203787-17849-2-git-send-email-aneesh.kumar@xxxxxxxxxxxxxxxxxx
-aneesh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>