Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_page.c
Show First 20 Lines • Show All 3,848 Lines • ▼ Show 20 Lines | while ((m = SLIST_FIRST(free)) != NULL) { | ||||
vm_page_free_toq(m); | vm_page_free_toq(m); | ||||
} | } | ||||
if (update_wire_count) | if (update_wire_count) | ||||
vm_wire_sub(count); | vm_wire_sub(count); | ||||
} | } | ||||
/* | /* | ||||
* Mark this page as wired down, preventing reclamation by the page daemon | * Mark this page as wired down. For managed pages, this prevents reclamation | ||||
* or when the containing object is destroyed. | * by the page daemon, or when the containing object, if any, is destroyed. | ||||
dougm: If there may be no containing object, this comment could be misleading. | |||||
*/ | */ | ||||
void | void | ||||
vm_page_wire(vm_page_t m) | vm_page_wire(vm_page_t m) | ||||
{ | { | ||||
u_int old; | u_int old; | ||||
KASSERT(m->object != NULL, | #ifdef INVARIANTS | ||||
("vm_page_wire: page %p does not belong to an object", m)); | if (m->object != NULL && !vm_page_busied(m) && | ||||
if (!vm_page_busied(m) && !vm_object_busied(m->object)) | !vm_object_busied(m->object)) | ||||
VM_OBJECT_ASSERT_LOCKED(m->object); | VM_OBJECT_ASSERT_LOCKED(m->object); | ||||
#endif | |||||
KASSERT((m->flags & PG_FICTITIOUS) == 0 || | KASSERT((m->flags & PG_FICTITIOUS) == 0 || | ||||
VPRC_WIRE_COUNT(m->ref_count) >= 1, | VPRC_WIRE_COUNT(m->ref_count) >= 1, | ||||
("vm_page_wire: fictitious page %p has zero wirings", m)); | ("vm_page_wire: fictitious page %p has zero wirings", m)); | ||||
old = atomic_fetchadd_int(&m->ref_count, 1); | old = atomic_fetchadd_int(&m->ref_count, 1); | ||||
KASSERT(VPRC_WIRE_COUNT(old) != VPRC_WIRE_COUNT_MAX, | KASSERT(VPRC_WIRE_COUNT(old) != VPRC_WIRE_COUNT_MAX, | ||||
("vm_page_wire: counter overflow for page %p", m)); | ("vm_page_wire: counter overflow for page %p", m)); | ||||
if (VPRC_WIRE_COUNT(old) == 0) { | if (VPRC_WIRE_COUNT(old) == 0) { | ||||
▲ Show 20 Lines • Show All 1,613 Lines • Show Last 20 Lines |
If there may be no containing object, this comment could be misleading.