* 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. */
| 3898 | * by the page daemon, or when the containing object, if any, is destroyed. |
| 3899 | */ |
| 3900 | void |
| 3901 | vm_page_wire(vm_page_t m) |
| 3902 | { |
| 3903 | u_int old; |
| 3904 | |
| 3905 | #ifdef INVARIANTS |
| 3906 | if (m->object != NULL && !vm_page_busied(m) && |
| 3907 | !vm_object_busied(m->object)) |
| 3908 | VM_OBJECT_ASSERT_LOCKED(m->object); |
| 3909 | #endif |
| 3910 | KASSERT((m->flags & PG_FICTITIOUS) == 0 || |
| 3911 | VPRC_WIRE_COUNT(m->ref_count) >= 1, |
| 3912 | ("vm_page_wire: fictitious page %p has zero wirings", m)); |
| 3913 | |
| 3914 | old = atomic_fetchadd_int(&m->ref_count, 1); |
| 3915 | KASSERT(VPRC_WIRE_COUNT(old) != VPRC_WIRE_COUNT_MAX, |
| 3916 | ("vm_page_wire: counter overflow for page %p", m)); |
| 3917 | if (VPRC_WIRE_COUNT(old) == 0) { |
| 3918 | if ((m->oflags & VPO_UNMANAGED) == 0) |
| 3919 | vm_page_aflag_set(m, PGA_DEQUEUE); |
| 3920 | vm_wire_add(1); |
| 3921 | } |
| 3922 | } |
| 3923 | |
| 3924 | /* |
| 3925 | * Attempt to wire a mapped page following a pmap lookup of that page. |
no test coverage detected