Permit vm_page_wire() to be called on pages not belonging to an object.
For such pages ref_count is effectively a consumer-managed field, but there is no harm in calling vm_page_wire() on them. vm_page_unwire_noq() handles them as well. Relax the vm_page_wire() assertions to permit this case which is triggered by some out-of-tree code. [1] Also guard a conditional assertion with INVARIANTS. Otherwise the conditions are evaluated even though the result is unused. [2] Reported by: bz, cem [1], kib [2] Reviewed by: dougm, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26173
This commit is contained in:
parent
464df865f8
commit
a90ef5362e
@ -3854,18 +3854,19 @@ vm_page_free_pages_toq(struct spglist *free, bool update_wire_count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark this page as wired down, preventing reclamation by the page daemon
|
||||
* or when the containing object is destroyed.
|
||||
* Mark this page as wired down. For managed pages, this prevents reclamation
|
||||
* by the page daemon, or when the containing object, if any, is destroyed.
|
||||
*/
|
||||
void
|
||||
vm_page_wire(vm_page_t m)
|
||||
{
|
||||
u_int old;
|
||||
|
||||
KASSERT(m->object != NULL,
|
||||
("vm_page_wire: page %p does not belong to an object", m));
|
||||
if (!vm_page_busied(m) && !vm_object_busied(m->object))
|
||||
#ifdef INVARIANTS
|
||||
if (m->object != NULL && !vm_page_busied(m) &&
|
||||
!vm_object_busied(m->object))
|
||||
VM_OBJECT_ASSERT_LOCKED(m->object);
|
||||
#endif
|
||||
KASSERT((m->flags & PG_FICTITIOUS) == 0 ||
|
||||
VPRC_WIRE_COUNT(m->ref_count) >= 1,
|
||||
("vm_page_wire: fictitious page %p has zero wirings", m));
|
||||
|
Loading…
x
Reference in New Issue
Block a user