Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Rather than using u_shorts, use u_ints and bitfields...



details:   https://anonhg.NetBSD.org/src/rev/fc69c19e4b32
branches:  trunk
changeset: 511847:fc69c19e4b32
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jun 28 00:26:38 2001 +0000

description:
Rather than using u_shorts, use u_ints and bitfields in the vm_page.  This
provides us more flexibility with pageq-locked fields, and clarifies the
locking semantics for platforms which cannot address shorts.

>From Ross Harvey.

diffstat:

 sys/uvm/uvm_page.h |  28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diffs (57 lines):

diff -r 0b0ea1c9eadc -r fc69c19e4b32 sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h        Wed Jun 27 23:57:16 2001 +0000
+++ b/sys/uvm/uvm_page.h        Thu Jun 28 00:26:38 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.h,v 1.26 2001/05/25 04:06:16 chs Exp $        */
+/*     $NetBSD: uvm_page.h,v 1.27 2001/06/28 00:26:38 thorpej Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -112,11 +112,6 @@
  * seperated things back out again.
  *
  * note the page structure has no lock of its own.
- *
- * XXX the use of locked u_short fields is dangerous, as they are not
- *     addressable on all architectures and hence cannot be individually
- *     locked. Right now it works because each aligned pair uses the same
- *     lock and all current ports can lock an int32_t.
  */
 
 #include <uvm/uvm_extern.h>
@@ -132,10 +127,13 @@
        struct uvm_object       *uobject;       /* object (O,P) */
        voff_t                  offset;         /* offset into object (O,P) */
 
-       u_short                 flags;          /* object flags [O] */
-       u_short                 version;        /* version count [O] */
-       u_short                 wire_count;     /* wired down map refs [P] */
-       u_short                 pqflags;        /* page queue flags [P] */
+       u_int                   flags:      16, /* object flags [O] */
+                               version:    16; /* version count [O] */
+
+       u_int                   wire_count: 16, /* wired down map refs [P] */
+                               pqflags:    8,  /* page queue flags [P] */
+                                      :    8;
+
        u_int                   loan_count;     /* number of active loans
                                                 * to read: [O or P]
                                                 * to modify: [O _and_ P] */
@@ -179,12 +177,12 @@
 
 #define PG_PAGER1      0x1000          /* pager-specific flag */
 
-#define PQ_FREE                0x0001          /* page is on free list */
-#define PQ_INACTIVE    0x0002          /* page is in inactive list */
-#define PQ_ACTIVE      0x0004          /* page is in active list */
-#define PQ_ANON                0x0010          /* page is part of an anon, rather
+#define PQ_FREE                0x01            /* page is on free list */
+#define PQ_INACTIVE    0x02            /* page is in inactive list */
+#define PQ_ACTIVE      0x04            /* page is in active list */
+#define PQ_ANON                0x10            /* page is part of an anon, rather
                                           than an uvm_object */
-#define PQ_AOBJ                0x0020          /* page is part of an anonymous
+#define PQ_AOBJ                0x20            /* page is part of an anonymous
                                           uvm_object */
 #define PQ_SWAPBACKED  (PQ_ANON|PQ_AOBJ)
 



Home | Main Index | Thread Index | Old Index