Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm remove the following options. no objections on tech...



details:   https://anonhg.NetBSD.org/src/rev/53682965c937
branches:  trunk
changeset: 588189:53682965c937
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sat Feb 11 12:45:07 2006 +0000

description:
remove the following options.  no objections on tech-kern@.

        UVM_PAGER_INLINE
        UVM_AMAP_INLINE
        UVM_PAGE_INLINE
        UVM_MAP_INLINE

diffstat:

 sys/uvm/Makefile      |    8 +-
 sys/uvm/uvm.h         |   31 +----
 sys/uvm/uvm_amap.c    |  232 +++++++++++++++++++++++++++++++++++++++-
 sys/uvm/uvm_amap.h    |   19 +---
 sys/uvm/uvm_amap_i.h  |  276 -----------------------------------------------
 sys/uvm/uvm_map.c     |  110 ++++++++++++++++++-
 sys/uvm/uvm_map.h     |   17 +--
 sys/uvm/uvm_map_i.h   |  189 --------------------------------
 sys/uvm/uvm_page.c    |  209 +++++++++++++++++++++++++++++++++++-
 sys/uvm/uvm_page.h    |   38 ++----
 sys/uvm/uvm_page_i.h  |  288 --------------------------------------------------
 sys/uvm/uvm_pager.c   |   24 +++-
 sys/uvm/uvm_pager.h   |   14 +--
 sys/uvm/uvm_pager_i.h |   71 ------------
 14 files changed, 586 insertions(+), 940 deletions(-)

diffs (truncated from 1800 to 300 lines):

diff -r d09a5e07a78a -r 53682965c937 sys/uvm/Makefile
--- a/sys/uvm/Makefile  Sat Feb 11 11:04:57 2006 +0000
+++ b/sys/uvm/Makefile  Sat Feb 11 12:45:07 2006 +0000
@@ -1,12 +1,12 @@
-#      $NetBSD: Makefile,v 1.8 2002/11/26 23:30:35 lukem Exp $
+#      $NetBSD: Makefile,v 1.9 2006/02/11 12:45:07 yamt Exp $
 
 INCSDIR= /usr/include/uvm
 
-INCS=  uvm.h uvm_amap.h uvm_amap_i.h uvm_anon.h uvm_aobj.h uvm_device.h \
+INCS=  uvm.h uvm_amap.h uvm_anon.h uvm_aobj.h uvm_device.h \
        uvm_extern.h uvm_fault.h uvm_fault_i.h uvm_glue.h \
        uvm_km.h uvm_loan.h \
-       uvm_map.h uvm_map_i.h uvm_object.h uvm_page.h uvm_page_i.h \
-       uvm_pager.h uvm_pager_i.h uvm_param.h uvm_pdaemon.h uvm_pglist.h \
+       uvm_map.h uvm_object.h uvm_page.h \
+       uvm_pager.h uvm_param.h uvm_pdaemon.h uvm_pglist.h \
        uvm_pmap.h uvm_prot.h uvm_stat.h \
        uvm_swap.h
 
diff -r d09a5e07a78a -r 53682965c937 sys/uvm/uvm.h
--- a/sys/uvm/uvm.h     Sat Feb 11 11:04:57 2006 +0000
+++ b/sys/uvm/uvm.h     Sat Feb 11 12:45:07 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm.h,v 1.42 2005/11/29 15:45:28 yamt Exp $    */
+/*     $NetBSD: uvm.h,v 1.43 2006/02/11 12:45:07 yamt Exp $    */
 
 /*
  *
@@ -191,33 +191,8 @@
 #define UVM_PAGE_OWN(PG, TAG) /* nothing */
 #endif /* UVM_PAGE_TRKOWN */
 
+#include <uvm/uvm_fault_i.h>
+
 #endif /* _KERNEL */
 
 #endif /* _UVM_UVM_H_ */
-
-/*
- * pull in inlines
- */
-
-#ifdef _KERNEL
-
-#if defined(UVM_AMAP_INLINE) || defined(UVM_AMAP_C)
-#include <uvm/uvm_amap_i.h>
-#endif
-
-#include <uvm/uvm_fault_i.h>
-
-#if defined(UVM_MAP_INLINE) || defined(UVM_MAP_C)
-#include <uvm/uvm_map_i.h>
-#endif
-
-#if defined(UVM_PAGE_INLINE) || defined(UVM_PAGE_C)
-#include <uvm/uvm_page_i.h>
-#endif
-
-#if defined(UVM_PAGER_INLINE) || defined(UVM_PAGER_C)
-#include <uvm/uvm_pager_i.h>
-#endif
-
-#endif /* _KERNEL */
-
diff -r d09a5e07a78a -r 53682965c937 sys/uvm/uvm_amap.c
--- a/sys/uvm/uvm_amap.c        Sat Feb 11 11:04:57 2006 +0000
+++ b/sys/uvm/uvm_amap.c        Sat Feb 11 12:45:07 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_amap.c,v 1.70 2006/01/21 13:13:07 yamt Exp $       */
+/*     $NetBSD: uvm_amap.c,v 1.71 2006/02/11 12:45:07 yamt Exp $       */
 
 /*
  *
@@ -42,9 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.70 2006/01/21 13:13:07 yamt Exp $");
-
-#undef UVM_AMAP_INLINE         /* enable/disable amap inlines */
+__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.71 2006/02/11 12:45:07 yamt Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -55,7 +53,6 @@
 #include <sys/kernel.h>
 #include <sys/pool.h>
 
-#define UVM_AMAP_C             /* ensure disabled inlines are in */
 #include <uvm/uvm.h>
 #include <uvm/uvm_swap.h>
 
@@ -1356,3 +1353,228 @@
 }
 
 #endif /* defined(VMSWAP) */
+
+/*
+ * amap_lookup: look up a page in an amap
+ *
+ * => amap should be locked by caller.
+ */
+struct vm_anon *
+amap_lookup(struct vm_aref *aref, vaddr_t offset)
+{
+       int slot;
+       struct vm_amap *amap = aref->ar_amap;
+       UVMHIST_FUNC("amap_lookup"); UVMHIST_CALLED(maphist);
+       LOCK_ASSERT(simple_lock_held(&amap->am_l));
+
+       AMAP_B2SLOT(slot, offset);
+       slot += aref->ar_pageoff;
+
+       if (slot >= amap->am_nslot)
+               panic("amap_lookup: offset out of range");
+
+       UVMHIST_LOG(maphist, "<- done (amap=0x%x, offset=0x%x, result=0x%x)",
+           amap, offset, amap->am_anon[slot], 0);
+       return(amap->am_anon[slot]);
+}
+
+/*
+ * amap_lookups: look up a range of pages in an amap
+ *
+ * => amap should be locked by caller.
+ * => XXXCDC: this interface is biased toward array-based amaps.  fix.
+ */
+void
+amap_lookups(struct vm_aref *aref, vaddr_t offset, struct vm_anon **anons,
+    int npages)
+{
+       int slot;
+       struct vm_amap *amap = aref->ar_amap;
+       UVMHIST_FUNC("amap_lookups"); UVMHIST_CALLED(maphist);
+       LOCK_ASSERT(simple_lock_held(&amap->am_l));
+
+       AMAP_B2SLOT(slot, offset);
+       slot += aref->ar_pageoff;
+
+       UVMHIST_LOG(maphist, "  slot=%d, npages=%d, nslot=%d", slot, npages,
+               amap->am_nslot, 0);
+
+       if ((slot + (npages - 1)) >= amap->am_nslot)
+               panic("amap_lookups: offset out of range");
+
+       memcpy(anons, &amap->am_anon[slot], npages * sizeof(struct vm_anon *));
+
+       UVMHIST_LOG(maphist, "<- done", 0, 0, 0, 0);
+       return;
+}
+
+/*
+ * amap_add: add (or replace) a page to an amap
+ *
+ * => caller must lock amap.
+ * => if (replace) caller must lock anon because we might have to call
+ *     pmap_page_protect on the anon's page.
+ */
+void
+amap_add(struct vm_aref *aref, vaddr_t offset, struct vm_anon *anon,
+    boolean_t replace)
+{
+       int slot;
+       struct vm_amap *amap = aref->ar_amap;
+       UVMHIST_FUNC("amap_add"); UVMHIST_CALLED(maphist);
+       LOCK_ASSERT(simple_lock_held(&amap->am_l));
+
+       AMAP_B2SLOT(slot, offset);
+       slot += aref->ar_pageoff;
+
+       if (slot >= amap->am_nslot)
+               panic("amap_add: offset out of range");
+
+       if (replace) {
+
+               if (amap->am_anon[slot] == NULL)
+                       panic("amap_add: replacing null anon");
+               if (amap->am_anon[slot]->an_page != NULL &&
+                   (amap->am_flags & AMAP_SHARED) != 0) {
+                       pmap_page_protect(amap->am_anon[slot]->an_page,
+                           VM_PROT_NONE);
+                       /*
+                        * XXX: suppose page is supposed to be wired somewhere?
+                        */
+               }
+       } else {   /* !replace */
+               if (amap->am_anon[slot] != NULL)
+                       panic("amap_add: slot in use");
+
+               amap->am_bckptr[slot] = amap->am_nused;
+               amap->am_slots[amap->am_nused] = slot;
+               amap->am_nused++;
+       }
+       amap->am_anon[slot] = anon;
+       UVMHIST_LOG(maphist,
+           "<- done (amap=0x%x, offset=0x%x, anon=0x%x, rep=%d)",
+           amap, offset, anon, replace);
+}
+
+/*
+ * amap_unadd: remove a page from an amap
+ *
+ * => caller must lock amap
+ */
+void
+amap_unadd(struct vm_aref *aref, vaddr_t offset)
+{
+       int ptr, slot;
+       struct vm_amap *amap = aref->ar_amap;
+       UVMHIST_FUNC("amap_unadd"); UVMHIST_CALLED(maphist);
+       LOCK_ASSERT(simple_lock_held(&amap->am_l));
+
+       AMAP_B2SLOT(slot, offset);
+       slot += aref->ar_pageoff;
+
+       if (slot >= amap->am_nslot)
+               panic("amap_unadd: offset out of range");
+
+       if (amap->am_anon[slot] == NULL)
+               panic("amap_unadd: nothing there");
+
+       amap->am_anon[slot] = NULL;
+       ptr = amap->am_bckptr[slot];
+
+       if (ptr != (amap->am_nused - 1)) {      /* swap to keep slots contig? */
+               amap->am_slots[ptr] = amap->am_slots[amap->am_nused - 1];
+               amap->am_bckptr[amap->am_slots[ptr]] = ptr;     /* back link */
+       }
+       amap->am_nused--;
+       UVMHIST_LOG(maphist, "<- done (amap=0x%x, slot=0x%x)", amap, slot,0, 0);
+}
+
+/*
+ * amap_ref: gain a reference to an amap
+ *
+ * => amap must not be locked (we will lock)
+ * => "offset" and "len" are in units of pages
+ * => called at fork time to gain the child's reference
+ */
+void
+amap_ref(struct vm_amap *amap, vaddr_t offset, vsize_t len, int flags)
+{
+       UVMHIST_FUNC("amap_ref"); UVMHIST_CALLED(maphist);
+
+       amap_lock(amap);
+       if (flags & AMAP_SHARED)
+               amap->am_flags |= AMAP_SHARED;
+#ifdef UVM_AMAP_PPREF
+       if (amap->am_ppref == NULL && (flags & AMAP_REFALL) == 0 &&
+           len != amap->am_nslot)
+               amap_pp_establish(amap, offset);
+#endif
+       amap->am_ref++;
+#ifdef UVM_AMAP_PPREF
+       if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
+               if (flags & AMAP_REFALL)
+                       amap_pp_adjref(amap, 0, amap->am_nslot, 1);
+               else
+                       amap_pp_adjref(amap, offset, len, 1);
+       }
+#endif
+       amap_unlock(amap);
+       UVMHIST_LOG(maphist,"<- done!  amap=0x%x", amap, 0, 0, 0);
+}
+
+/*
+ * amap_unref: remove a reference to an amap
+ *
+ * => caller must remove all pmap-level references to this amap before
+ *     dropping the reference
+ * => called from uvm_unmap_detach [only]  ... note that entry is no
+ *     longer part of a map and thus has no need for locking
+ * => amap must be unlocked (we will lock it).
+ */
+void
+amap_unref(struct vm_amap *amap, vaddr_t offset, vsize_t len, boolean_t all)
+{
+       UVMHIST_FUNC("amap_unref"); UVMHIST_CALLED(maphist);
+
+       /*
+        * lock it
+        */
+       amap_lock(amap);
+       UVMHIST_LOG(maphist,"  amap=0x%x  refs=%d, nused=%d",
+           amap, amap->am_ref, amap->am_nused, 0);
+
+       KASSERT(amap_refs(amap) > 0);
+
+       /*
+        * if we are the last reference, free the amap and return.
+        */
+
+       amap->am_ref--;
+
+       if (amap_refs(amap) == 0) {
+               amap_wipeout(amap);     /* drops final ref and frees */
+               UVMHIST_LOG(maphist,"<- done (was last ref)!", 0, 0, 0, 0);
+               return;                 /* no need to unlock */
+       }



Home | Main Index | Thread Index | Old Index