Thread (19 messages) 19 messages, 4 authors, 2021-01-12

Re: [PATCH v2 2/3] mm: Allow architectures to request 'old' entries when prefaulting

From: Kirill A. Shutemov <hidden>
Date: 2021-01-11 14:47:52
Also in: linux-mm, lkml

On Mon, Jan 11, 2021 at 02:37:42PM +0000, Will Deacon wrote:
On Mon, Jan 11, 2021 at 05:25:33PM +0300, Kirill A. Shutemov wrote:
quoted
On Fri, Jan 08, 2021 at 05:15:16PM +0000, Will Deacon wrote:
quoted
diff --git a/mm/filemap.c b/mm/filemap.c
index c1f2dc89b8a7..0fb9d1714797 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3051,14 +3051,18 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
 		if (!pte_none(*vmf->pte))
 			goto unlock;
 
+		/* We're about to handle the fault */
+		if (vmf->address == address) {
+			vmf->flags &= ~FAULT_FLAG_PREFAULT;
+			ret = VM_FAULT_NOPAGE;
+		} else {
+			vmf->flags |= FAULT_FLAG_PREFAULT;
+		}
+
Do we need to restore the oririnal status of the bit once we are done?
I can certainly add that, although it doesn't look like we do that for
vmf->pte, so it's hard to tell what the rules are here. It certainly feels
odd to restore some fields but not others, as it looks like vmf->address
will be out-of-whack with vmf->pte when filemap_map_pages() returns. Am I
missing something?
Unlike vmf->flags or vmf->address, vmf->pte is not going to be reused.
finish_fault() will overwrite it.

Yeah, it's messy.

-- 
 Kirill A. Shutemov

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help