Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm reduce the number of atomic ops in common cases. it...



details:   https://anonhg.NetBSD.org/src/rev/14f39ee8db02
branches:  trunk
changeset: 766969:14f39ee8db02
user:      yamt <yamt%NetBSD.org@localhost>
date:      Tue Jul 05 13:47:24 2011 +0000

description:
reduce the number of atomic ops in common cases.  it's exceptional for
anons to remain longer than amap.

diffstat:

 sys/uvm/uvm_amap.c  |  5 ++---
 sys/uvm/uvm_anon.c  |  9 +++------
 sys/uvm/uvm_fault.c |  6 ++----
 3 files changed, 7 insertions(+), 13 deletions(-)

diffs (100 lines):

diff -r 89374cc4b34f -r 14f39ee8db02 sys/uvm/uvm_amap.c
--- a/sys/uvm/uvm_amap.c        Tue Jul 05 10:42:54 2011 +0000
+++ b/sys/uvm/uvm_amap.c        Tue Jul 05 13:47:24 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_amap.c,v 1.100 2011/06/27 15:56:36 hannken Exp $   */
+/*     $NetBSD: uvm_amap.c,v 1.101 2011/07/05 13:47:24 yamt Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.100 2011/06/27 15:56:36 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.101 2011/07/05 13:47:24 yamt Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1060,7 +1060,6 @@
                 */
 
                nanon->an_lock = amap->am_lock;
-               mutex_obj_hold(nanon->an_lock);
                uvm_pagecopy(pg, npg);
                anon->an_ref--;
                KASSERT(anon->an_ref > 0);
diff -r 89374cc4b34f -r 14f39ee8db02 sys/uvm/uvm_anon.c
--- a/sys/uvm/uvm_anon.c        Tue Jul 05 10:42:54 2011 +0000
+++ b/sys/uvm/uvm_anon.c        Tue Jul 05 13:47:24 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_anon.c,v 1.57 2011/06/24 01:39:22 rmind Exp $      */
+/*     $NetBSD: uvm_anon.c,v 1.58 2011/07/05 13:47:24 yamt Exp $       */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.57 2011/06/24 01:39:22 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.58 2011/07/05 13:47:24 yamt Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -158,6 +158,7 @@
 
                        if (pg->flags & PG_BUSY) {
                                pg->flags |= PG_RELEASED;
+                               mutex_obj_hold(anon->an_lock);
                                return;
                        }
                        mutex_enter(&uvm_pageqlock);
@@ -191,9 +192,6 @@
        KASSERT(anon->an_swslot == 0);
 #endif
 
-       if (anon->an_lock != NULL) {
-               mutex_obj_free(anon->an_lock);
-       }
        pool_cache_put(&uvm_anon_cache, anon);
        UVMHIST_LOG(maphist,"<- done!",0,0,0,0);
 }
@@ -422,7 +420,6 @@
 
        KASSERT(anon->an_page == NULL);
 
-       mutex_obj_hold(lock);
        uvm_anfree(anon);
        mutex_exit(lock);
        mutex_obj_free(lock);
diff -r 89374cc4b34f -r 14f39ee8db02 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Tue Jul 05 10:42:54 2011 +0000
+++ b/sys/uvm/uvm_fault.c       Tue Jul 05 13:47:24 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.188 2011/06/24 01:39:22 rmind Exp $    */
+/*     $NetBSD: uvm_fault.c,v 1.189 2011/07/05 13:47:24 yamt Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.188 2011/06/24 01:39:22 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.189 2011/07/05 13:47:24 yamt Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -614,11 +614,9 @@
 
                KASSERT(anon->an_lock == NULL);
                anon->an_lock = amap->am_lock;
-               mutex_obj_hold(anon->an_lock);
                pg = uvm_pagealloc(NULL, ufi->orig_rvaddr, anon,
                    UVM_FLAG_COLORMATCH | (opg == NULL ? UVM_PGA_ZERO : 0));
                if (pg == NULL) {
-                       mutex_obj_free(anon->an_lock);
                        anon->an_lock = NULL;
                }
        } else {



Home | Main Index | Thread Index | Old Index