summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2013-03-17 16:06:03 +0000
committeralc <alc@FreeBSD.org>2013-03-17 16:06:03 +0000
commitb346e448af4fd8a3d9a582e850a73123d59e467f (patch)
tree858e7bfe2f55f71153cb9b03fcf3d6caa40b68f6
parenta2e67affe3d12d77ed0950538f3fd7bf0963454c (diff)
downloadFreeBSD-src-b346e448af4fd8a3d9a582e850a73123d59e467f.zip
FreeBSD-src-b346e448af4fd8a3d9a582e850a73123d59e467f.tar.gz
Simplify the interface to vm_radix_insert() by eliminating the parameter
"index". The content of a radix tree leaf, or at least its "key", is not opaque to the other radix tree operations. Specifically, they know how to extract the "key" from a leaf. So, eliminating the parameter "index" isn't breaking the abstraction. Moreover, eliminating the parameter "index" effectively prevents the caller from passing an inconsistent "index" and leaf to vm_radix_insert(). Reviewed by: attilio Sponsored by: EMC / Isilon Storage Division
-rw-r--r--sys/amd64/amd64/pmap.c2
-rw-r--r--sys/i386/i386/pmap.c2
-rw-r--r--sys/vm/vm_page.c6
-rw-r--r--sys/vm/vm_radix.c7
-rw-r--r--sys/vm/vm_radix.h3
5 files changed, 9 insertions, 11 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 4a1ee86..324fc69 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1533,7 +1533,7 @@ pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte)
{
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
- vm_radix_insert(&pmap->pm_root, mpte->pindex, mpte);
+ vm_radix_insert(&pmap->pm_root, mpte);
}
/*
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 50cd325..ba63e21 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -1609,7 +1609,7 @@ pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte)
{
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
- vm_radix_insert(&pmap->pm_root, mpte->pindex, mpte);
+ vm_radix_insert(&pmap->pm_root, mpte);
}
/*
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 79af894..31cbd7a 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -836,7 +836,7 @@ vm_page_insert(vm_page_t m, vm_object_t object, vm_pindex_t pindex)
} else
TAILQ_INSERT_TAIL(&object->memq, m, listq);
}
- vm_radix_insert(&object->rtree, pindex, m);
+ vm_radix_insert(&object->rtree, m);
/*
* Show that the object has one more resident page.
@@ -1113,7 +1113,7 @@ vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart,
/* Update the page's object and offset. */
m->object = new_object;
m->pindex -= offidxstart;
- vm_radix_insert(&new_object->cache, m->pindex, m);
+ vm_radix_insert(&new_object->cache, m);
}
mtx_unlock(&vm_page_queue_free_mtx);
}
@@ -2187,7 +2187,7 @@ vm_page_cache(vm_page_t m)
m->flags |= PG_CACHED;
cnt.v_cache_count++;
cache_was_empty = vm_radix_is_empty(&object->cache);
- vm_radix_insert(&object->cache, m->pindex, m);
+ vm_radix_insert(&object->cache, m);
#if VM_NRESERVLEVEL > 0
if (!vm_reserv_free_page(m)) {
#else
diff --git a/sys/vm/vm_radix.c b/sys/vm/vm_radix.c
index d71cb55..0d7fcc6 100644
--- a/sys/vm/vm_radix.c
+++ b/sys/vm/vm_radix.c
@@ -373,16 +373,15 @@ vm_radix_init(void)
* Panics if the key already exists.
*/
void
-vm_radix_insert(struct vm_radix *rtree, vm_pindex_t index, vm_page_t page)
+vm_radix_insert(struct vm_radix *rtree, vm_page_t page)
{
- vm_pindex_t newind;
+ vm_pindex_t index, newind;
struct vm_radix_node *rnode, *tmp, *tmp2;
vm_page_t m;
int slot;
uint16_t clev;
- KASSERT(index == page->pindex, ("%s: index != page->pindex",
- __func__));
+ index = page->pindex;
/*
* The owner of record for root is not really important because it
diff --git a/sys/vm/vm_radix.h b/sys/vm/vm_radix.h
index ff8d16d..4ac0a06 100644
--- a/sys/vm/vm_radix.h
+++ b/sys/vm/vm_radix.h
@@ -35,8 +35,7 @@
#ifdef _KERNEL
void vm_radix_init(void);
-void vm_radix_insert(struct vm_radix *rtree, vm_pindex_t index,
- vm_page_t page);
+void vm_radix_insert(struct vm_radix *rtree, vm_page_t page);
vm_page_t vm_radix_lookup(struct vm_radix *rtree, vm_pindex_t index);
vm_page_t vm_radix_lookup_ge(struct vm_radix *rtree, vm_pindex_t index);
vm_page_t vm_radix_lookup_le(struct vm_radix *rtree, vm_pindex_t index);
OpenPOWER on IntegriCloud