Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm detect wraparound when bumping page wir...



details:   https://anonhg.NetBSD.org/src/rev/757a9bbf9a29
branches:  trunk
changeset: 319162:757a9bbf9a29
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat May 19 11:02:33 2018 +0000

description:
detect wraparound when bumping page wire_count and loan_count

diffstat:

 sys/uvm/uvm_loan.c |  5 +++--
 sys/uvm/uvm_page.c |  5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 6f2dc468be8e -r 757a9bbf9a29 sys/uvm/uvm_loan.c
--- a/sys/uvm/uvm_loan.c        Sat May 19 09:32:55 2018 +0000
+++ b/sys/uvm/uvm_loan.c        Sat May 19 11:02:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_loan.c,v 1.85 2017/10/28 00:37:13 pgoyette Exp $   */
+/*     $NetBSD: uvm_loan.c,v 1.86 2018/05/19 11:02:33 jdolecek Exp $   */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.85 2017/10/28 00:37:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.86 2018/05/19 11:02:33 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -424,6 +424,7 @@
                pmap_page_protect(pg, VM_PROT_READ);
        }
        pg->loan_count++;
+       KASSERT(pg->loan_count > 0);    /* detect wrap-around */
        uvm_pageactivate(pg);
        mutex_exit(&uvm_pageqlock);
        **output = pg;
diff -r 6f2dc468be8e -r 757a9bbf9a29 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c        Sat May 19 09:32:55 2018 +0000
+++ b/sys/uvm/uvm_page.c        Sat May 19 11:02:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.196 2018/04/24 16:35:53 jakllsch Exp $  */
+/*     $NetBSD: uvm_page.c,v 1.197 2018/05/19 11:02:33 jdolecek Exp $  */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.196 2018/04/24 16:35:53 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.197 2018/05/19 11:02:33 jdolecek Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvm.h"
@@ -1591,6 +1591,7 @@
                uvmexp.wired++;
        }
        pg->wire_count++;
+       KASSERT(pg->wire_count > 0);    /* detect wraparound */
 }
 
 /*



Home | Main Index | Thread Index | Old Index