* Unwire a page and either attempt to free it or re-add it to the page queues. */
| 4189 | * Unwire a page and either attempt to free it or re-add it to the page queues. |
| 4190 | */ |
| 4191 | void |
| 4192 | vm_page_release(vm_page_t m, int flags) |
| 4193 | { |
| 4194 | vm_object_t object; |
| 4195 | |
| 4196 | KASSERT((m->oflags & VPO_UNMANAGED) == 0, |
| 4197 | ("vm_page_release: page %p is unmanaged", m)); |
| 4198 | |
| 4199 | if ((flags & VPR_TRYFREE) != 0) { |
| 4200 | for (;;) { |
| 4201 | object = atomic_load_ptr(&m->object); |
| 4202 | if (object == NULL) |
| 4203 | break; |
| 4204 | /* Depends on type-stability. */ |
| 4205 | if (vm_page_busied(m) || !VM_OBJECT_TRYWLOCK(object)) |
| 4206 | break; |
| 4207 | if (object == m->object) { |
| 4208 | vm_page_release_locked(m, flags); |
| 4209 | VM_OBJECT_WUNLOCK(object); |
| 4210 | return; |
| 4211 | } |
| 4212 | VM_OBJECT_WUNLOCK(object); |
| 4213 | } |
| 4214 | } |
| 4215 | vm_page_unwire_managed(m, PQ_INACTIVE, flags != 0); |
| 4216 | } |
| 4217 | |
| 4218 | /* See vm_page_release(). */ |
| 4219 | void |
no test coverage detected