Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm uvm_map_lock_entry: fix the order of locking. Spott...



details:   https://anonhg.NetBSD.org/src/rev/c6e2e992734a
branches:  trunk
changeset: 766027:c6e2e992734a
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon Jun 13 23:19:40 2011 +0000

description:
uvm_map_lock_entry: fix the order of locking.  Spotted by yamt@.
Also, keep uvm_map_unlock_entry() symmetric.

diffstat:

 sys/uvm/uvm_map.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (49 lines):

diff -r 9ae81e2243cc -r c6e2e992734a sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Mon Jun 13 21:32:42 2011 +0000
+++ b/sys/uvm/uvm_map.c Mon Jun 13 23:19:40 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.298 2011/06/12 03:36:03 rmind Exp $      */
+/*     $NetBSD: uvm_map.c,v 1.299 2011/06/13 23:19:40 rmind Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.298 2011/06/12 03:36:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.299 2011/06/13 23:19:40 rmind Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -5204,24 +5204,24 @@
 uvm_map_lock_entry(struct vm_map_entry *entry)
 {
 
+       if (entry->aref.ar_amap != NULL) {
+               amap_lock(entry->aref.ar_amap);
+       }
        if (UVM_ET_ISOBJ(entry)) {
                mutex_enter(entry->object.uvm_obj->vmobjlock);
        }
-       if (entry->aref.ar_amap != NULL) {
-               amap_lock(entry->aref.ar_amap);
-       }
 }
 
 void
 uvm_map_unlock_entry(struct vm_map_entry *entry)
 {
 
+       if (UVM_ET_ISOBJ(entry)) {
+               mutex_exit(entry->object.uvm_obj->vmobjlock);
+       }
        if (entry->aref.ar_amap != NULL) {
                amap_unlock(entry->aref.ar_amap);
        }
-       if (UVM_ET_ISOBJ(entry)) {
-               mutex_exit(entry->object.uvm_obj->vmobjlock);
-       }
 }
 
 #if defined(DDB) || defined(DEBUGPRINT)



Home | Main Index | Thread Index | Old Index