Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm uvm_loanuobjpages():



details:   https://anonhg.NetBSD.org/src/rev/863c0f97454b
branches:  trunk
changeset: 933170:863c0f97454b
user:      ad <ad%NetBSD.org@localhost>
date:      Wed May 20 18:37:50 2020 +0000

description:
uvm_loanuobjpages():

- there are no pages to unbusy in the error case
- always clear the caller's page array

diffstat:

 sys/uvm/uvm_loan.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r 1a0a0f5d94f6 -r 863c0f97454b sys/uvm/uvm_loan.c
--- a/sys/uvm/uvm_loan.c        Wed May 20 17:48:34 2020 +0000
+++ b/sys/uvm/uvm_loan.c        Wed May 20 18:37:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_loan.c,v 1.102 2020/05/19 21:52:04 ad Exp $        */
+/*     $NetBSD: uvm_loan.c,v 1.103 2020/05/20 18:37:50 ad 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.102 2020/05/19 21:52:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.103 2020/05/20 18:37:50 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -538,6 +538,9 @@
                /* loan out pages.  they will be unbusied whatever happens. */
                error = uvm_loanpage(pgpp, npages, true);
                rw_exit(uobj->vmobjlock);
+               if (error != 0) {
+                       memset(pgpp, 0, sizeof(pgpp[0]) * npages);
+               }
                return error;
 
        case EAGAIN:
@@ -546,11 +549,6 @@
                goto reget;
 
        default:
-               if (npages > 0) {
-                       rw_enter(uobj->vmobjlock, RW_WRITER);
-                       uvm_page_unbusy(pgpp, npages);
-                       rw_exit(uobj->vmobjlock);
-               }
                return error;
        }
 }
@@ -569,6 +567,7 @@
 
        KASSERT(npages > 0);
 
+       memset(pgpp, 0, sizeof(pgpp[0]) * npages);
        for (ndone = 0; ndone < npages; ndone += chunk) {
                chunk = MIN(UVM_LOAN_GET_CHUNK, npages - ndone);
                error = uvm_loanuobjchunk(uobj, pgoff + (ndone << PAGE_SHIFT),



Home | Main Index | Thread Index | Old Index