summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-06-28 07:58:10 +0000
committeralc <alc@FreeBSD.org>2003-06-28 07:58:10 +0000
commit1eef33b7057b76cb79b810e307cb47467fee1e7d (patch)
tree24cd8451c29ce3448c4713231bc6ac3e1bc3466e /sys/vm
parentbb3ae5a363724befe0ef582c8f0424dbf6a094d1 (diff)
downloadFreeBSD-src-1eef33b7057b76cb79b810e307cb47467fee1e7d.zip
FreeBSD-src-1eef33b7057b76cb79b810e307cb47467fee1e7d.tar.gz
- Use an int rather than a vm_pindex_t to represent the desired page
color in vm_page_alloc(). (This also has small performance benefits.) - Eliminate vm_page_select_free(); vm_page_alloc() might as well call vm_pageq_find() directly.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_page.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index ac3cccc..0df20b5 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -711,13 +711,13 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex)
* This routine may not block.
*/
static vm_page_t
-vm_page_select_cache(vm_pindex_t color)
+vm_page_select_cache(int color)
{
vm_page_t m;
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
while (TRUE) {
- m = vm_pageq_find(PQ_CACHE, color & PQ_L2_MASK, FALSE);
+ m = vm_pageq_find(PQ_CACHE, color, FALSE);
if (m && ((m->flags & (PG_BUSY|PG_UNMANAGED)) || m->busy ||
m->hold_count || m->wire_count ||
!VM_OBJECT_TRYLOCK(m->object))) {
@@ -729,23 +729,6 @@ vm_page_select_cache(vm_pindex_t color)
}
/*
- * vm_page_select_free:
- *
- * Find a free or zero page, with specified preference.
- *
- * This routine must be called at splvm().
- * This routine may not block.
- */
-static __inline vm_page_t
-vm_page_select_free(vm_pindex_t color, boolean_t prefer_zero)
-{
- vm_page_t m;
-
- m = vm_pageq_find(PQ_FREE, color & PQ_L2_MASK, prefer_zero);
- return (m);
-}
-
-/*
* vm_page_alloc:
*
* Allocate and return a memory cell associated
@@ -768,8 +751,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
{
vm_object_t m_object;
vm_page_t m = NULL;
- vm_pindex_t color;
- int flags, page_req, s;
+ int color, flags, page_req, s;
page_req = req & VM_ALLOC_CLASS_MASK;
@@ -778,9 +760,9 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
("vm_page_alloc: NULL object."));
KASSERT(!vm_page_lookup(object, pindex),
("vm_page_alloc: page already allocated"));
- color = pindex + object->pg_color;
+ color = (pindex + object->pg_color) & PQ_L2_MASK;
} else
- color = pindex;
+ color = pindex & PQ_L2_MASK;
/*
* The pager is allowed to eat deeper into the free page list.
@@ -801,7 +783,7 @@ loop:
* Allocate from the free queue if the number of free pages
* exceeds the minimum for the request class.
*/
- m = vm_page_select_free(color, (req & VM_ALLOC_ZERO) != 0);
+ m = vm_pageq_find(PQ_FREE, color, (req & VM_ALLOC_ZERO) != 0);
} else if (page_req != VM_ALLOC_INTERRUPT) {
mtx_unlock_spin(&vm_page_queue_free_mtx);
/*
OpenPOWER on IntegriCloud