summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_aobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/uvm/uvm_aobj.c')
-rw-r--r--sys/uvm/uvm_aobj.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index bae91b851e3..d13e8cf9c2b 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_aobj.c,v 1.18 2001/11/06 13:36:52 art Exp $ */
-/* $NetBSD: uvm_aobj.c,v 1.34 2000/08/02 20:23:23 thorpej Exp $ */
+/* $OpenBSD: uvm_aobj.c,v 1.19 2001/11/07 02:55:50 art Exp $ */
+/* $NetBSD: uvm_aobj.c,v 1.37 2000/11/25 06:27:59 chs Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -47,6 +47,7 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/malloc.h>
+#include <sys/kernel.h>
#include <sys/pool.h>
#include <sys/kernel.h>
@@ -180,8 +181,6 @@ static boolean_t uao_releasepg __P((struct vm_page *,
static boolean_t uao_pagein __P((struct uvm_aobj *, int, int));
static boolean_t uao_pagein_page __P((struct uvm_aobj *, int));
-
-
/*
* aobj_pager
*
@@ -195,11 +194,9 @@ struct uvm_pagerops aobj_pager = {
NULL, /* fault */
uao_flush, /* flush */
uao_get, /* get */
- NULL, /* asyncget */
NULL, /* put (done by pagedaemon) */
NULL, /* cluster */
NULL, /* mk_pcluster */
- NULL, /* aiodone */
uao_releasepg /* releasepg */
};
@@ -242,7 +239,7 @@ uao_find_swhash_elt(aobj, pageidx, create)
/*
* now search the bucket for the requested tag
*/
- for (elt = swhash->lh_first; elt != NULL; elt = elt->list.le_next) {
+ LIST_FOREACH(elt, swhash, list) {
if (elt->tag == page_tag)
return(elt);
}
@@ -374,7 +371,6 @@ uao_set_swslot(uobj, pageidx, slot)
pool_put(&uao_swhash_elt_pool, elt);
}
}
-
} else {
/* we are using an array */
oldslot = aobj->u_swslots[pageidx];
@@ -417,17 +413,18 @@ uao_free(aobj)
for (j = 0; j < UAO_SWHASH_CLUSTER_SIZE; j++) {
int slot = elt->slots[j];
- if (slot) {
- uvm_swap_free(slot, 1);
-
- /*
- * this page is no longer
- * only in swap.
- */
- simple_lock(&uvm.swap_data_lock);
- uvmexp.swpgonly--;
- simple_unlock(&uvm.swap_data_lock);
+ if (slot == 0) {
+ continue;
}
+ uvm_swap_free(slot, 1);
+
+ /*
+ * this page is no longer
+ * only in swap.
+ */
+ simple_lock(&uvm.swap_data_lock);
+ uvmexp.swpgonly--;
+ simple_unlock(&uvm.swap_data_lock);
}
next = LIST_NEXT(elt, list);
@@ -851,7 +848,7 @@ uao_flush(uobj, start, stop, flags)
for ( ; (by_list && pp != NULL) ||
(!by_list && curoff < stop) ; pp = ppnext) {
if (by_list) {
- ppnext = pp->listq.tqe_next;
+ ppnext = TAILQ_NEXT(pp, listq);
/* range check */
if (pp->offset < start || pp->offset >= stop)
@@ -971,7 +968,7 @@ uao_get(uobj, offset, pps, npagesp, centeridx, access_type, advice, flags)
UVMHIST_LOG(pdhist, "aobj=%p offset=%d, flags=%d",
aobj, offset, flags,0);
-
+
/*
* get number of pages
*/
@@ -1250,7 +1247,7 @@ uao_get(uobj, offset, pps, npagesp, centeridx, access_type, advice, flags)
* => returns TRUE if page's object is still alive, FALSE if we
* killed the page's object. if we return TRUE, then we
* return with the object locked.
- * => if (nextpgp != NULL) => we return pageq.tqe_next here, and return
+ * => if (nextpgp != NULL) => we return the next page on the queue, and return
* with the page queues locked [for pagedaemon]
* => if (nextpgp == NULL) => we return with page queues unlocked [normal case]
* => we kill the aobj if it is not referenced and we are suppose to
@@ -1275,7 +1272,7 @@ uao_releasepg(pg, nextpgp)
uao_dropswap(&aobj->u_obj, pg->offset >> PAGE_SHIFT);
uvm_lock_pageq();
if (nextpgp)
- *nextpgp = pg->pageq.tqe_next; /* next page for daemon */
+ *nextpgp = TAILQ_NEXT(pg, pageq); /* next page for daemon */
uvm_pagefree(pg);
if (!nextpgp)
uvm_unlock_pageq(); /* keep locked for daemon */
@@ -1285,11 +1282,7 @@ uao_releasepg(pg, nextpgp)
*/
if ((aobj->u_flags & UAO_FLAG_KILLME) == 0)
return TRUE;
-
-#ifdef DIAGNOSTIC
- if (aobj->u_obj.uo_refs)
- panic("uvm_km_releasepg: kill flag set on referenced object!");
-#endif
+ KASSERT(aobj->u_obj.uo_refs == 0);
/*
* if there are still pages in the object, we're done for now.
@@ -1493,7 +1486,6 @@ uao_pagein_page(aobj, pageidx)
{
struct vm_page *pg;
int rv, slot, npages;
- UVMHIST_FUNC("uao_pagein_page"); UVMHIST_CALLED(pdhist);
pg = NULL;
npages = 1;