Simplify vm_page_dequeue() and fix an assertion.
- Add a vm_pagequeue_remove() function to physically remove a page from its queue and update the queue length.
- Remove vm_page_pagequeue_lockptr() and let vm_page_pagequeue() return NULL for dequeued pages.
- Avoid unnecessarily reloading the queue index if vm_page_dequeue() loses a race with a concurrent queue operation.
- Correct an always-true assertion: vm_page_dequeue() may be called from the page allocator with the page unlocked. The assertion m->order == VM_NFREEORDER simply tests whether the page has been removed from the vm_phys free lists; instead, check whether the page belongs to an object.
Reviewed by: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21341