diff options
author | alc <alc@FreeBSD.org> | 2012-10-29 06:15:04 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2012-10-29 06:15:04 +0000 |
commit | 77582e8298a329afe130b4707b2f655de8f47469 (patch) | |
tree | a62e7875d6bda03cb63a3bc9d351a84c9934e260 /sys/vm/vm_page.c | |
parent | 308e8489e1e1c15be83ab48adaf765eb34bea461 (diff) | |
download | FreeBSD-src-77582e8298a329afe130b4707b2f655de8f47469.zip FreeBSD-src-77582e8298a329afe130b4707b2f655de8f47469.tar.gz |
Replace the page hold queue, PQ_HOLD, by a new page flag, PG_UNHOLDFREE,
because the queue itself serves no purpose. When a held page is freed,
inserting the page into the hold queue has the side effect of setting the
page's "queue" field to PQ_HOLD. Later, when the page is unheld, it will
be freed because the "queue" field is PQ_HOLD. In other words, PQ_HOLD is
used as a flag, not a queue. So, this change replaces it with a flag.
To accomodate the new page flag, make the page's "flags" field wider and
"oflags" field narrower.
Reviewed by: kib
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r-- | sys/vm/vm_page.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 8f5182f..d3c797d 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -308,7 +308,6 @@ vm_page_startup(vm_offset_t vaddr) TAILQ_INIT(&vm_page_queues[i].pl); vm_page_queues[PQ_INACTIVE].cnt = &cnt.v_inactive_count; vm_page_queues[PQ_ACTIVE].cnt = &cnt.v_active_count; - vm_page_queues[PQ_HOLD].cnt = &cnt.v_active_count; /* * Allocate memory for use when boot strapping the kernel memory @@ -540,7 +539,7 @@ vm_page_unhold(vm_page_t mem) vm_page_lock_assert(mem, MA_OWNED); --mem->hold_count; KASSERT(mem->hold_count >= 0, ("vm_page_unhold: hold count < 0!!!")); - if (mem->hold_count == 0 && mem->queue == PQ_HOLD) + if (mem->hold_count == 0 && (mem->flags & PG_UNHOLDFREE) != 0) vm_page_free_toq(mem); } @@ -2042,9 +2041,9 @@ vm_page_free_toq(vm_page_t m) panic("vm_page_free: freeing wired page %p", m); if (m->hold_count != 0) { m->flags &= ~PG_ZERO; - vm_page_lock_queues(); - vm_page_enqueue(PQ_HOLD, m); - vm_page_unlock_queues(); + KASSERT((m->flags & PG_UNHOLDFREE) == 0, + ("vm_page_free: freeing PG_UNHOLDFREE page %p", m)); + m->flags |= PG_UNHOLDFREE; } else { /* * Restore the default memory attribute to the page. |