Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Macro'ize the test for "object is a kernel object".



details:   https://anonhg.NetBSD.org/src/rev/08d8aca2e906
branches:  trunk
changeset: 473210:08d8aca2e906
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 25 00:09:00 1999 +0000

description:
Macro'ize the test for "object is a kernel object".

diffstat:

 sys/uvm/uvm_aobj.c   |   6 +++---
 sys/uvm/uvm_map.c    |  15 ++++++++-------
 sys/uvm/uvm_object.h |   4 +++-
 sys/uvm/uvm_page.c   |   4 ++--
 4 files changed, 16 insertions(+), 13 deletions(-)

diffs (106 lines):

diff -r 9c5ebad82e67 -r 08d8aca2e906 sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Mon May 24 23:36:23 1999 +0000
+++ b/sys/uvm/uvm_aobj.c        Tue May 25 00:09:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.19 1999/04/11 04:04:11 chs Exp $        */
+/*     $NetBSD: uvm_aobj.c,v 1.20 1999/05/25 00:09:00 thorpej Exp $    */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -623,7 +623,7 @@
         * kernel_object already has plenty of references, leave it alone.
         */
 
-       if (uobj->uo_refs == UVM_OBJ_KERN)
+       if (UVM_OBJ_IS_KERN_OBJECT(uobj))
                return;
 
        simple_lock(&uobj->vmobjlock);
@@ -650,7 +650,7 @@
        /*
         * detaching from kernel_object is a noop.
         */
-       if (uobj->uo_refs == UVM_OBJ_KERN)
+       if (UVM_OBJ_IS_KERN_OBJECT(uobj))
                return;
 
        simple_lock(&uobj->vmobjlock);
diff -r 9c5ebad82e67 -r 08d8aca2e906 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Mon May 24 23:36:23 1999 +0000
+++ b/sys/uvm/uvm_map.c Tue May 25 00:09:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.41 1999/05/23 06:27:13 mrg Exp $ */
+/*     $NetBSD: uvm_map.c,v 1.42 1999/05/25 00:09:00 thorpej Exp $     */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -548,8 +548,9 @@
        } else {
                if (uoffset == UVM_UNKNOWN_OFFSET) {
 #ifdef DIAGNOSTIC
-                       if (uobj->uo_refs != UVM_OBJ_KERN)
-       panic("uvm_map: unknown offset with non-kernel object");
+                       if (UVM_OBJ_IS_KERN_OBJECT(uobj) == 0)
+                               panic("uvm_map: unknown offset with "
+                                   "non-kernel object");
 #endif
                        uoffset = *startp - vm_map_min(kernel_map);
                }
@@ -981,11 +982,11 @@
                 * we want to free these pages right away...
                 */
                if (UVM_ET_ISOBJ(entry) &&
-                   entry->object.uvm_obj->uo_refs == UVM_OBJ_KERN) {
-
+                   UVM_OBJ_IS_KERN_OBJECT(entry->object.uvm_obj)) {
 #ifdef DIAGNOSTIC
                        if (vm_map_pmap(map) != pmap_kernel())
-       panic("uvm_unmap_remove: kernel object mapped by non-kernel map");
+                               panic("uvm_unmap_remove: kernel object "
+                                   "mapped by non-kernel map");
 #endif
 
                        /*
@@ -2974,7 +2975,7 @@
 
        (*pr)("OBJECT %p: pgops=%p, npages=%d, ", uobj, uobj->pgops,
            uobj->uo_npages);
-       if (uobj->uo_refs == UVM_OBJ_KERN)
+       if (UVM_OBJ_IS_KERN_OBJECT(uobj))
                (*pr)("refs=<SYSTEM>\n");
        else
                (*pr)("refs=%d\n", uobj->uo_refs);
diff -r 9c5ebad82e67 -r 08d8aca2e906 sys/uvm/uvm_object.h
--- a/sys/uvm/uvm_object.h      Mon May 24 23:36:23 1999 +0000
+++ b/sys/uvm/uvm_object.h      Tue May 25 00:09:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_object.h,v 1.6 1999/03/25 18:48:53 mrg Exp $       */
+/*     $NetBSD: uvm_object.h,v 1.7 1999/05/25 00:09:01 thorpej Exp $   */
 
 /*
  *
@@ -67,4 +67,6 @@
  */
 #define UVM_OBJ_KERN   (-2)
 
+#define        UVM_OBJ_IS_KERN_OBJECT(uobj)    ((uobj)->uo_refs == UVM_OBJ_KERN)
+
 #endif /* _UVM_UVM_OBJECT_H_ */
diff -r 9c5ebad82e67 -r 08d8aca2e906 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c        Mon May 24 23:36:23 1999 +0000
+++ b/sys/uvm/uvm_page.c        Tue May 25 00:09:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.21 1999/05/24 19:10:57 thorpej Exp $    */
+/*     $NetBSD: uvm_page.c,v 1.22 1999/05/25 00:09:01 thorpej Exp $    */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -866,7 +866,7 @@
         */
 
        use_reserve = (flags & UVM_PGA_USERESERVE) ||
-               (obj && obj->uo_refs == UVM_OBJ_KERN);
+               (obj && UVM_OBJ_IS_KERN_OBJECT(obj));
        if ((uvmexp.free <= uvmexp.reserve_kernel && !use_reserve) ||
            (uvmexp.free <= uvmexp.reserve_pagedaemon &&
             !(use_reserve && curproc == uvm.pagedaemon_proc)))



Home | Main Index | Thread Index | Old Index