Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Make previous work as intended. Bad programmer.



details:   https://anonhg.NetBSD.org/src/rev/273349a6fa5a
branches:  trunk
changeset: 1010454:273349a6fa5a
user:      ad <ad%NetBSD.org@localhost>
date:      Mon May 25 22:01:26 2020 +0000

description:
Make previous work as intended.  Bad programmer.

diffstat:

 sys/uvm/uvm_page_array.c |  27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diffs (62 lines):

diff -r a69e640b5373 -r 273349a6fa5a sys/uvm/uvm_page_array.c
--- a/sys/uvm/uvm_page_array.c  Mon May 25 21:22:40 2020 +0000
+++ b/sys/uvm/uvm_page_array.c  Mon May 25 22:01:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page_array.c,v 1.7 2020/05/25 21:22:40 ad Exp $    */
+/*     $NetBSD: uvm_page_array.c,v 1.8 2020/05/25 22:01:26 ad Exp $    */
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page_array.c,v 1.7 2020/05/25 21:22:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page_array.c,v 1.8 2020/05/25 22:01:26 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -180,12 +180,12 @@
                         * set of arguments, in the current version of the
                         * tree.
                         *
-                        * minimize repeated tree lookups by "finding" some
-                        * null pointers, in case the caller keeps looping
-                        * (a common use case).
+                        * minimize repeated tree lookups by "finding" a
+                        * null pointer, in case the caller keeps looping (a
+                        * common use case).
                         */
-                       npages = maxpages;
-                       memset(ar->ar_pages, 0, sizeof(ar->ar_pages[0]) * npages);
+                       npages = 1;
+                       ar->ar_pages[0] = NULL;
                }
        }
        KASSERT(npages <= maxpages);
@@ -220,20 +220,17 @@
  */
 
 struct vm_page *
-uvm_page_array_fill_and_peek(struct uvm_page_array *a, voff_t off,
+uvm_page_array_fill_and_peek(struct uvm_page_array *ar, voff_t off,
     unsigned int nwant)
 {
-       struct vm_page *pg;
        int error;
 
-       pg = uvm_page_array_peek(a);
-       if (pg != NULL) {
-               return pg;
+       if (ar->ar_idx != ar->ar_npages) {
+               return ar->ar_pages[ar->ar_idx];
        }
-       error = uvm_page_array_fill(a, off, nwant);
+       error = uvm_page_array_fill(ar, off, nwant);
        if (error != 0) {
                return NULL;
        }
-       pg = uvm_page_array_peek(a);
-       return pg;
+       return uvm_page_array_peek(ar);
 }



Home | Main Index | Thread Index | Old Index