[Patch 1/2] Add a NOPAGE_FAULTED flag.

Robin Holt
2005-10-12T19:41:41Z

Introduce a NOPAGE_FAULTED flag. This flag is returned from a drivers
nopage handler to indicate the desired pte has been inserted and should
be handled as a minor fault.

Signed-off-by: holt@sgi.com

Index: linux-2.6/include/linux/mm.h
===================================================================
--- linux-2.6.orig/include/linux/mm.h 2005-10-11 21:15:45.147011169 -0500
+++ linux-2.6/include/linux/mm.h 2005-10-11 21:17:15.814561844 -0500
@@ -619,6 +619,7 @@ static inline int page_mapped(struct pag
*/
#define NOPAGE_SIGBUS (NULL)
#define NOPAGE_OOM ((struct page *) (-1))
+#define NOPAGE_FAULTED ((struct page *) (-2))

/*
* Different kinds of faults, as returned by handle_mm_fault().
Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c 2005-10-11 21:15:45.162634582 -0500
+++ linux-2.6/mm/memory.c 2005-10-11 21:17:15.849714525 -0500
@@ -1862,6 +1862,14 @@ retry:
return VM_FAULT_SIGBUS;
if (new_page == NOPAGE_OOM)
return VM_FAULT_OOM;
+ if (new_page == NOPAGE_FAULTED) {
+ spin_lock(&mm->page_table_lock);
+ page_table = pte_offset_map(pmd, address);
+ pte_unmap(page_table);
+ spin_unlock(&mm->page_table_lock);
+
+ return VM_FAULT_MINOR;
+ }

/*
* Should we do an early C-O-W break?