linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* PATCH [2.4.0test10]: Kiobuf#02, fault-in fix
@ 2000-11-02 13:40 Stephen C. Tweedie
  2000-11-02 14:30 ` Jeff Garzik
  2000-11-03 22:27 ` Andrea Arcangeli
  0 siblings, 2 replies; 16+ messages in thread
From: Stephen C. Tweedie @ 2000-11-02 13:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Rik van Riel, Ingo Molnar, Stephen Tweedie, linux-mm

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

Hi,

Next part of the kiobuf diffs: fix the fact that handle_mm_fault
doesn't guarantee to complete the operation in all cases; doesn't
guarantee that the resulting pte is writable if write access was
requested; and doesn't pin the page against immediately being swapped
back out.

--Stephen


[-- Attachment #2: 02-faultfix.diff --]
[-- Type: text/plain, Size: 1586 bytes --]

Only in linux-2.4.0-test10.kio.01/drivers/char: raw.c.~1~
Only in linux-2.4.0-test10.kio.01/fs: buffer.c.~1~
Only in linux-2.4.0-test10.kio.01/fs: iobuf.c.~1~
Only in linux-2.4.0-test10.kio.01/include/linux: iobuf.h.~1~
diff -ru linux-2.4.0-test10.kio.01/mm/memory.c linux-2.4.0-test10.kio.02/mm/memory.c
--- linux-2.4.0-test10.kio.01/mm/memory.c	Thu Nov  2 11:59:11 2000
+++ linux-2.4.0-test10.kio.02/mm/memory.c	Thu Nov  2 12:39:16 2000
@@ -384,7 +384,7 @@
 /*
  * Do a quick page-table lookup for a single page. 
  */
-static struct page * follow_page(unsigned long address) 
+static struct page * follow_page(unsigned long address, int write) 
 {
 	pgd_t *pgd;
 	pmd_t *pmd;
@@ -394,7 +394,8 @@
 	if (pmd) {
 		pte_t * pte = pte_offset(pmd, address);
 		if (pte && pte_present(*pte))
-			return pte_page(*pte);
+			if (!write || pte_write(*pte))
+				return pte_page(*pte);
 	}
 	
 	return NULL;
@@ -474,11 +475,14 @@
 		if (handle_mm_fault(current->mm, vma, ptr, datain) <= 0) 
 			goto out_unlock;
 		spin_lock(&mm->page_table_lock);
-		map = follow_page(ptr);
+		map = follow_page(ptr, datain);
 		if (!map) {
+			/* If handle_mm_fault did not complete the
+                           operation, or if we hit the swapout race
+                           before taking the page_table_lock, just try
+                           again on this page. */
 			spin_unlock(&mm->page_table_lock);
-			dprintk (KERN_ERR "Missing page in map_user_kiobuf\n");
-			goto out_unlock;
+			continue;
 		}
 		map = get_page_map(map);
 		if (map)
Only in linux-2.4.0-test10.kio.01/mm: memory.c.~1~

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2000-11-08 12:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-02 13:40 PATCH [2.4.0test10]: Kiobuf#02, fault-in fix Stephen C. Tweedie
2000-11-02 14:30 ` Jeff Garzik
2000-11-02 15:58   ` Stephen C. Tweedie
2000-11-04  1:28     ` Eric Lowe
2000-11-03 22:27 ` Andrea Arcangeli
2000-11-04  1:36   ` Eric Lowe
2000-11-04  2:07     ` Andrea Arcangeli
2000-11-06 15:05   ` Stephen C. Tweedie
2000-11-06 16:12     ` Andrea Arcangeli
2000-11-06 16:54       ` Stephen C. Tweedie
2000-11-06 22:34         ` Andrea Arcangeli
2000-11-07 11:17           ` Stephen C. Tweedie
2000-11-06 17:23     ` Linus Torvalds
2000-11-07 11:57       ` Stephen C. Tweedie
2000-11-07 13:37         ` Andrea Arcangeli
2000-11-08 12:31       ` Stephen C. Tweedie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox