summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim/vm_machdep.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2004-03-16 19:04:28 +0000
committeralc <alc@FreeBSD.org>2004-03-16 19:04:28 +0000
commita2e820d27ba39950df6b8aae95fdca17e3eeb69d (patch)
tree23b7ae48f580ace96e1510d279da96896036cc35 /sys/powerpc/aim/vm_machdep.c
parent71c3a1c44c43ab6da664e5414fb5ae531038d5c5 (diff)
downloadFreeBSD-src-a2e820d27ba39950df6b8aae95fdca17e3eeb69d.zip
FreeBSD-src-a2e820d27ba39950df6b8aae95fdca17e3eeb69d.tar.gz
Refactor the existing machine-dependent sf_buf_free() into a machine-
dependent function by the same name and a machine-independent function, sf_buf_mext(). Aside from the virtue of making more of the code machine- independent, this change also makes the interface more logical. Before, sf_buf_free() did more than simply undo an sf_buf_alloc(); it also unwired and if necessary freed the page. That is now the purpose of sf_buf_mext(). Thus, sf_buf_alloc() and sf_buf_free() can now be used as a general-purpose emphemeral map cache.
Diffstat (limited to 'sys/powerpc/aim/vm_machdep.c')
-rw-r--r--sys/powerpc/aim/vm_machdep.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
index 857822c..d174bc9 100644
--- a/sys/powerpc/aim/vm_machdep.c
+++ b/sys/powerpc/aim/vm_machdep.c
@@ -292,28 +292,13 @@ sf_buf_alloc(struct vm_page *m)
}
/*
- * Detatch mapped page and release resources back to the system.
+ * Release resources back to the system.
*/
void
-sf_buf_free(void *addr, void *args)
+sf_buf_free(struct sf_buf *sf)
{
- struct sf_buf *sf;
- struct vm_page *m;
- sf = args;
- pmap_qremove((vm_offset_t)addr, 1);
- m = sf->m;
- vm_page_lock_queues();
- vm_page_unwire(m, 0);
- /*
- * Check for the object going away on us. This can
- * happen since we don't hold a reference to it.
- * If so, we're responsible for freeing the page.
- */
- if (m->wire_count == 0 && m->object == NULL)
- vm_page_free(m);
- vm_page_unlock_queues();
- sf->m = NULL;
+ pmap_qremove(sf->kva, 1);
mtx_lock(&sf_freelist.sf_lock);
SLIST_INSERT_HEAD(&sf_freelist.sf_head, sf, free_list);
nsfbufsused--;
OpenPOWER on IntegriCloud