* Attempt to wire a mapped page following a pmap lookup of that page. * This may fail if a thread is concurrently tearing down mappings of the page. * The transient failure is acceptable because it translates to the * failure of the caller pmap_extract_and_hold(), which should be then * followed by the vm_fault() fallback, see e.g. vm_fault_quick_hold_pages(). */
| 3929 | * followed by the vm_fault() fallback, see e.g. vm_fault_quick_hold_pages(). |
| 3930 | */ |
| 3931 | bool |
| 3932 | vm_page_wire_mapped(vm_page_t m) |
| 3933 | { |
| 3934 | u_int old; |
| 3935 | |
| 3936 | old = m->ref_count; |
| 3937 | do { |
| 3938 | KASSERT(old > 0, |
| 3939 | ("vm_page_wire_mapped: wiring unreferenced page %p", m)); |
| 3940 | if ((old & VPRC_BLOCKED) != 0) |
| 3941 | return (false); |
| 3942 | } while (!atomic_fcmpset_int(&m->ref_count, &old, old + 1)); |
| 3943 | |
| 3944 | if (VPRC_WIRE_COUNT(old) == 0) { |
| 3945 | if ((m->oflags & VPO_UNMANAGED) == 0) |
| 3946 | vm_page_aflag_set(m, PGA_DEQUEUE); |
| 3947 | vm_wire_add(1); |
| 3948 | } |
| 3949 | return (true); |
| 3950 | } |
| 3951 | |
| 3952 | /* |
| 3953 | * Release a wiring reference to a managed page. If the page still belongs to |
no test coverage detected