Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Avoid calling pmap_page_protect() while under uvm_pa...



details:   https://anonhg.NetBSD.org/src/rev/b97f77d85984
branches:  trunk
changeset: 846807:b97f77d85984
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Dec 01 20:31:40 2019 +0000

description:
Avoid calling pmap_page_protect() while under uvm_pageqlock.

diffstat:

 sys/uvm/uvm_aobj.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 39469fea0192 -r b97f77d85984 sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Sun Dec 01 20:28:25 2019 +0000
+++ b/sys/uvm/uvm_aobj.c        Sun Dec 01 20:31:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.129 2019/12/01 14:40:31 ad Exp $        */
+/*     $NetBSD: uvm_aobj.c,v 1.130 2019/12/01 20:31:40 ad Exp $        */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.129 2019/12/01 14:40:31 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.130 2019/12/01 20:31:40 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -411,7 +411,7 @@
 uao_create(voff_t size, int flags)
 {
        static struct uvm_aobj kernel_object_store;
-       static kmutex_t kernel_object_lock;
+       static kmutex_t kernel_object_lock __cacheline_aligned;
        static int kobj_alloced __diagused = 0;
        pgoff_t pages = round_page((uint64_t)size) >> PAGE_SHIFT;
        struct uvm_aobj *aobj;
@@ -614,9 +614,11 @@
         */
 
        mutex_enter(uobj->vmobjlock);
+       TAILQ_FOREACH(pg, &uobj->memq, listq.queue) {
+               pmap_page_protect(pg, VM_PROT_NONE);
+       }
        mutex_enter(&uvm_pageqlock);
        while ((pg = TAILQ_FIRST(&uobj->memq)) != NULL) {
-               pmap_page_protect(pg, VM_PROT_NONE);
                if (pg->flags & PG_BUSY) {
                        pg->flags |= PG_WANTED;
                        mutex_exit(&uvm_pageqlock);



Home | Main Index | Thread Index | Old Index