Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm when wiring swap-backed pages, clear the PG_CLEAN fl...



details:   https://anonhg.NetBSD.org/src/rev/595989b593d2
branches:  trunk
changeset: 473073:595989b593d2
user:      chs <chs%NetBSD.org@localhost>
date:      Wed May 19 06:14:15 1999 +0000

description:
when wiring swap-backed pages, clear the PG_CLEAN flag before
releasing any swap resources.  if we don't do this, we can
end up with a clean, swap-backed page, which is illegal.
tracked down by Bill Sommerfeld, fixes PR 7578.

diffstat:

 sys/uvm/uvm_fault.c |  23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r 65f25133ff6f -r 595989b593d2 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Wed May 19 05:49:06 1999 +0000
+++ b/sys/uvm/uvm_fault.c       Wed May 19 06:14:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.28 1999/04/11 04:04:11 chs Exp $       */
+/*     $NetBSD: uvm_fault.c,v 1.29 1999/05/19 06:14:15 chs Exp $       */
 
 /*
  *
@@ -1214,11 +1214,19 @@
 
        if (fault_type == VM_FAULT_WIRE) {
                uvm_pagewire(pg);
+
+               /*
+                * since the now-wired page cannot be paged out,
+                * release its swap resources for others to use.
+                * since an anon with no swap cannot be PG_CLEAN,
+                * clear its clean flag now.
+                */
+
+               pg->flags &= ~(PG_CLEAN);
                uvm_anon_dropswap(anon);
        } else {
                /* activate it */
                uvm_pageactivate(pg);
-
        }
 
        uvm_unlock_pageq();
@@ -1638,13 +1646,20 @@
        if (fault_type == VM_FAULT_WIRE) {
                uvm_pagewire(pg);
                if (pg->pqflags & PQ_AOBJ) {
+
+                       /*
+                        * since the now-wired page cannot be paged out,
+                        * release its swap resources for others to use.
+                        * since an aobj page with no swap cannot be PG_CLEAN,
+                        * clear its clean flag now.
+                        */
+
+                       pg->flags &= ~(PG_CLEAN);
                        uao_dropswap(uobj, pg->offset >> PAGE_SHIFT);
                }
        } else {
-               
                /* activate it */
                uvm_pageactivate(pg);
-
        }
 
        uvm_unlock_pageq();



Home | Main Index | Thread Index | Old Index